summaryrefslogtreecommitdiff
path: root/demos/2d/shower_of_bullets/shower.gd
diff options
context:
space:
mode:
Diffstat (limited to 'demos/2d/shower_of_bullets/shower.gd')
-rw-r--r--demos/2d/shower_of_bullets/shower.gd30
1 files changed, 12 insertions, 18 deletions
diff --git a/demos/2d/shower_of_bullets/shower.gd b/demos/2d/shower_of_bullets/shower.gd
index bba8431764..0f87c60bcd 100644
--- a/demos/2d/shower_of_bullets/shower.gd
+++ b/demos/2d/shower_of_bullets/shower.gd
@@ -1,32 +1,26 @@
extends Node2D
-# member variables here, example:
-# var a=2
-# var b="textvar"
+# Member variables
+var touching = 0
-var touching=0
+func _input(event):
+ if (event.type == InputEvent.MOUSE_MOTION):
+ get_node("player").set_pos(event.pos - Vector2(0, 16))
-func _input(ev):
- if (ev.type==InputEvent.MOUSE_MOTION):
- get_node("player").set_pos(ev.pos-Vector2(0,16))
-
-
-func _on_player_body_enter_shape( body_id, body, body_shape, area_shape ):
-
- touching+=1
- if (touching==1):
+func _on_player_body_enter_shape(body_id, body, body_shape, area_shape):
+ touching += 1
+ if (touching == 1):
get_node("player/sprite").set_frame(1)
-func _on_player_body_exit_shape( body_id, body, body_shape, area_shape ):
-
- touching-=1
- if (touching==0):
+func _on_player_body_exit_shape(body_id, body, body_shape, area_shape):
+ touching -= 1
+ if (touching == 0):
get_node("player/sprite").set_frame(0)
func _ready():
+ # Initialization here
set_process_input(true)
- pass