TowerGame/scripts/spawner.gd

16 lines
371 B
GDScript3
Raw Normal View History

2025-04-26 16:02:13 +01:00
extends Node3D
@export var spawn_scene: PackedScene = null
@export var spawn_time: float = 5.0
var spawn_timer: float = 0.0
func _process(delta: float) -> void:
spawn_timer += delta
if spawn_timer >= spawn_time:
spawn_timer -= spawn_time
var node: Node = spawn_scene.instantiate()
add_child(node)
if node is Node3D:
node.global_position = global_position