"I attempted to create a simple exit button. It initially worked, but then I accidentally erased my code and had to rewrite it. However, now it doesn't work at all, not even the _process(delta) function:
I attempted to have it print something
I also tried placing it in its own TEST.tscn scene, but that also didn't work.
# Variable that checks if the mouse is on the CollisionShape2D
var is_on = false
# Checks every tick. If the variable is_on is true, then if there's a left-click input, it will quit the game.
func _process(delta):
print("MAKINGSURE")
if is_on:
if Input.is_action_just_pressed("ui_left"):
get_tree().quit()
# Checks if the mouse is on CollisionShape2D. If true, is_on becomes true, and the Sprite changes to frame 1.
func _on_Area2D_mouse_entered():
is_on = true
$AnimatedSprite.frame = 1
# Checks if the mouse is on CollisionShape2D. If false, is_on becomes false, and the Sprite changes to frame 0.
func _on_Area2D_mouse_exited():
is_on = false
$AnimatedSprite.frame = 0````