Godot Version
4.7
Question
So I wanna make a button. If the button is touching the mouse it switches costume but its not working. The AnimatedSprite2D is child of Button Node btw
extends Button
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
mouse_entered.connect(_on_mouse_entered)
mouse_exited.connect(_on_mouse_exited)
func _on_mouse_entered() -> void:
$AnimatedSprite2D.animation = 1
func _on_mouse_exited() -> void:
$AnimatedSprite2D.animation = 0
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass