shower.gd 521 B

1234567891011121314151617181920212223242526
  1. extends Node2D
  2. # Member variables
  3. var touching = 0
  4. func _input(event):
  5. if (event.type == InputEvent.MOUSE_MOTION):
  6. get_node("player").set_pos(event.pos - Vector2(0, 16))
  7. func _on_player_body_enter_shape(body_id, body, body_shape, area_shape):
  8. touching += 1
  9. if (touching == 1):
  10. get_node("player/sprite").set_frame(1)
  11. func _on_player_body_exit_shape(body_id, body, body_shape, area_shape):
  12. touching -= 1
  13. if (touching == 0):
  14. get_node("player/sprite").set_frame(0)
  15. func _ready():
  16. set_process_input(true)