shower.gd 554 B

123456789101112131415161718192021222324252627282930313233
  1. extends Node2D
  2. # member variables here, example:
  3. # var a=2
  4. # var b="textvar"
  5. var touching=0
  6. func _input(ev):
  7. if (ev.type==InputEvent.MOUSE_MOTION):
  8. get_node("player").set_pos(ev.pos-Vector2(0,16))
  9. func _on_player_body_enter_shape( body_id, body, body_shape, area_shape ):
  10. touching+=1
  11. if (touching==1):
  12. get_node("player/sprite").set_frame(1)
  13. func _on_player_body_exit_shape( body_id, body, body_shape, area_shape ):
  14. touching-=1
  15. if (touching==0):
  16. get_node("player/sprite").set_frame(0)
  17. func _ready():
  18. set_process_input(true)
  19. pass