You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
387 B

  1. extends KinematicBody
  2. signal switch
  3. export var initial_state := false
  4. var activated := false
  5. func _ready():
  6. activated = initial_state
  7. update_view()
  8. emit_signal("switch", activated)
  9. func on_interact():
  10. activated = !activated
  11. update_view()
  12. emit_signal("switch", activated)
  13. func update_view():
  14. if activated:
  15. $AnimationPlayer.play("On")
  16. else:
  17. $AnimationPlayer.play("Off")