summaryrefslogtreecommitdiff
path: root/demos/2d/hdr/beach_cave.gd
diff options
context:
space:
mode:
Diffstat (limited to 'demos/2d/hdr/beach_cave.gd')
-rw-r--r--demos/2d/hdr/beach_cave.gd26
1 files changed, 26 insertions, 0 deletions
diff --git a/demos/2d/hdr/beach_cave.gd b/demos/2d/hdr/beach_cave.gd
new file mode 100644
index 0000000000..9dffbc4662
--- /dev/null
+++ b/demos/2d/hdr/beach_cave.gd
@@ -0,0 +1,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
+
+