2025-01-28 18:32:38 +00:00
|
|
|
extends Node
|
2025-02-01 17:03:00 +00:00
|
|
|
class_name BulletSpawnerController
|
2025-01-28 18:32:38 +00:00
|
|
|
# This script shoud be able to find the player
|
|
|
|
|
|
|
|
var players: Dictionary = {}
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready() -> void:
|
|
|
|
pass # Replace with function body.
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
func _process(delta: float) -> void:
|
|
|
|
pass
|
2025-02-01 17:03:00 +00:00
|
|
|
|
|
|
|
func _get_spawner() -> MultiplayerSpawner:
|
|
|
|
return $MultiplayerSpawner
|
|
|
|
|
|
|
|
func _get_root() -> Node3D:
|
|
|
|
return $Bullets
|
|
|
|
|
|
|
|
# -- TODO: Better bullet naming handler
|
|
|
|
var bullet_amount: int = -2147483647
|
|
|
|
func spawn_bullet(starting_point: Node3D, speed: int, damage: int):
|
|
|
|
var node: Node3D = ResourceLoader.load("res://scenes/weapon/bullet.tscn").instantiate()
|
|
|
|
node.position = starting_point.global_position
|
|
|
|
node.transform.basis = starting_point.global_transform.basis
|
|
|
|
node.name = str(bullet_amount)
|
|
|
|
node.speed = speed
|
|
|
|
node.damage = damage
|
|
|
|
bullet_amount += 1
|
|
|
|
_get_root().add_child(node)
|