beach_cave.gd 363 B

1234567891011121314151617
  1. extends Node2D
  2. const CAVE_LIMIT = 1000
  3. onready var cave = $Cave
  4. func _unhandled_input(event):
  5. if event is InputEventMouseMotion and event.button_mask > 0:
  6. var rel_x = event.relative.x
  7. var cavepos = cave.position
  8. cavepos.x += rel_x
  9. if cavepos.x < -CAVE_LIMIT:
  10. cavepos.x = -CAVE_LIMIT
  11. elif cavepos.x > 0:
  12. cavepos.x = 0
  13. cave.position = cavepos