Files
hsgj25-growth/growth/virus_spawner.gd
2025-10-05 13:07:32 +02:00

19 lines
376 B
GDScript

extends Node
@export var Virus : PackedScene
@export var spawn_distance = 1000
var player
func _ready():
self.player = get_node("../Player")
func _process(delta):
pass
func _on_timer_timeout():
var virus = Virus.instantiate()
var direction = Vector2.RIGHT.rotated(randf_range(0, 2*PI))
virus.position = player.position + direction * spawn_distance
add_child(virus)