extends CharacterBody2D @export var egg_scene: PackedScene var speed = 150 var direction = Vector2.ZERO func _ready(): $Timer.timeout.connect(_on_Timer_timeout) randomize() change_direction() func _process(delta): velocity = direction * speed move_and_slide() func _on_Timer_timeout(): var new_egg = egg_scene.instantiate() new_egg.global_position = global_position get_parent().add_child(new_egg) change_direction() func change_direction(): direction = Vector2.from_angle(randf() * PI * 2)
terça-feira, 12 de agosto de 2025
Assinar:
Postar comentários (Atom)
0 comentários:
Postar um comentário