The game crashes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dawoodywoody

extends Area2D
export var road_side = “left”
var timer = “timed”

func _ready() → void:
position = Vector2(0, 0)

func if_donkey_entered(_body):
queue_free()

func _process(_delta: float) → void:
while timer == “timed”:
print(“test 2”)
if Input.is_action_pressed(“ui_select”):
if road_side == “left”:
position += Vector2(3, 0)
road_side = “right”
timer = “timing”
yield(get_tree().create_timer(0.5), “timeout”)
timer = “timed”
else: if road_side == “right”:
position += Vector2(-3, 0)
road_side = “left”
timer = “timing”
yield(get_tree().create_timer(0.5), “timeout”)
timer = “timed”

Yes, and? Your project may be crashing, but you haven’t told us what the error message is, nor how your scene is set up.

Ertain | 2022-10-24 12:23

:bust_in_silhouette: Reply From: Cire_arievilo1

maybe this is it

while timer == “timed”

that is giving an error you can try to change the while to an if.

Thanks, it works!

Dawoodywoody | 2022-10-24 14:56