summaryrefslogtreecommitdiff
path: root/demos/2d/hdr/beach_cave.gd
blob: 9dffbc46622e7fb12672266c893d49ad8174fb1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

extends Node2D

# member variables here, example:
# var a=2
# var b="textvar"
const CAVE_LIMIT=1000

func _input(ev):
	if (ev.type==InputEvent.MOUSE_MOTION and ev.button_mask&1):
		var rel_x = ev.relative_x
		var cavepos = get_node("cave").get_pos()
		cavepos.x+=rel_x
		if (cavepos.x<-CAVE_LIMIT):
			cavepos.x=-CAVE_LIMIT
		elif (cavepos.x>0):
			cavepos.x=0
		get_node("cave").set_pos(cavepos)
			

func _ready():
	set_process_input(true)
	# Initialization here
	pass