extends KinematicBody signal switch export var initial_state := false var activated := false func _ready(): activated = initial_state update_view() emit_signal("switch", activated) func on_interact(): activated = !activated update_view() emit_signal("switch", activated) func update_view(): if activated: $AnimationPlayer.play("On") else: $AnimationPlayer.play("Off")