pandemonium_demo_projects/2d/hdr/beach_cave.gd

17 lines
363 B
GDScript3
Raw Normal View History

extends Node2D
const CAVE_LIMIT = 1000
onready var cave = $Cave
func _unhandled_input(event):
if event is InputEventMouseMotion and event.button_mask > 0:
var rel_x = event.relative.x
var cavepos = cave.position
cavepos.x += rel_x
if cavepos.x < -CAVE_LIMIT:
cavepos.x = -CAVE_LIMIT
elif cavepos.x > 0:
cavepos.x = 0
cave.position = cavepos