diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2015-11-21 16:13:43 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2015-12-09 08:39:12 +0100 |
commit | 7589b2bf605b58fbb0e34dec8ae833708e9b54ea (patch) | |
tree | 6c6b6515be9d121127f738a586fd95299ca7018a /demos/2d/hdr | |
parent | 323dde7f3164477b3d51fda8352d8b37a19f7f9d (diff) |
Improve code formatting
The scripts were streamlined using more or less the following conventions:
- space after a comma in lists of arguments
- spaces around weak operators (+, -), no spaces around strong operators (*, /)
- spaces around comparison operators and compound assignment operators
- space after a comment start (#)
- removed trailing spaces or tabs, apart from those that delimit the function indentation level (those could be removed too but since they are added automatically by the editor when typing code, keeping them for now)
- function blocks separate by two newlines
- comment sentences start with an upper-case letter
Diffstat (limited to 'demos/2d/hdr')
-rw-r--r-- | demos/2d/hdr/beach_cave.gd | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/demos/2d/hdr/beach_cave.gd b/demos/2d/hdr/beach_cave.gd index 9dffbc4662..9829bd3611 100644 --- a/demos/2d/hdr/beach_cave.gd +++ b/demos/2d/hdr/beach_cave.gd @@ -1,26 +1,22 @@ 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 - - + set_process_input(true) |