If the button is a Button node (or similar), then you can use the pressed
signal to detect if the button has been pressed. Then, you can use an AnimationPlayer to play an animation that does whatever you need, like open a door, move a platform, etc.
Something like this (untested):
var has_button_been_pressed = false
func _ready():
get_node("Button").connect("pressed", self, "on_button_pressed")
func on_button_pressed():
# only trigger the animation once!
if has_button_been_pressed == true:
return
has_button_been_pressed = true
# play the animation (I assume the name of the animation is "button_animation" in the code below)
get_node("AnimationPlayer").play("button_animation")
So, for the platform example, you can have an animation called "button_animation" that moves the platform between two keyframed positions in the animation. :smile: