diff options
author | Juan Linietsky <reduzio@gmail.com> | 2015-12-09 09:10:00 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2015-12-09 09:10:00 -0300 |
commit | aadced2f72476f637c6c14e48d3811e088eda951 (patch) | |
tree | 34df51f29d92225f28dcdfc495b8796ae7430ceb /demos/2d/hdr/beach_cave.gd | |
parent | 6bc6b8fcf24bdfcae4a990054c9077e1bc5a87e5 (diff) | |
parent | db9da152765357c5e484792fc5e31a25acbc7616 (diff) |
Merge branch 'master' of https://github.com/godotengine/godot
Diffstat (limited to 'demos/2d/hdr/beach_cave.gd')
-rw-r--r-- | demos/2d/hdr/beach_cave.gd | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/demos/2d/hdr/beach_cave.gd b/demos/2d/hdr/beach_cave.gd index 9dffbc4662..fcc878e565 100644 --- a/demos/2d/hdr/beach_cave.gd +++ b/demos/2d/hdr/beach_cave.gd @@ -1,26 +1,21 @@ extends Node2D -# member variables here, example: -# var a=2 -# var b="textvar" -const CAVE_LIMIT=1000 +# Member variables +const CAVE_LIMIT = 1000 -func _input(ev): - if (ev.type==InputEvent.MOUSE_MOTION and ev.button_mask&1): - var rel_x = ev.relative_x + +func _input(event): + if (event.type == InputEvent.MOUSE_MOTION and event.button_mask&1): + var rel_x = event.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 + 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 - - |