summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authormarcelofg55 <marcelofg55@gmail.com>2016-06-02 18:56:28 -0300
committermarcelofg55 <marcelofg55@gmail.com>2016-06-02 18:56:28 -0300
commit4e0f2389c3a79f1e558ee13e6d51e7dbe531368e (patch)
treea8bd2b831ae005a614d2a5c8a56ea4bccec3d59e /demos
parentbb223869e0d016d372d8f3d98b3d5680cc069368 (diff)
parentbc25492e636a82a30d77aa1b37edede0a2a9182f (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'demos')
-rw-r--r--demos/2d/space_shooter/asteroid.gd6
-rw-r--r--demos/2d/space_shooter/enemy1.gd6
-rw-r--r--demos/2d/space_shooter/enemy2.gd10
-rw-r--r--demos/2d/space_shooter/rail.gd6
-rw-r--r--demos/2d/space_shooter/ship.gd4
5 files changed, 14 insertions, 18 deletions
diff --git a/demos/2d/space_shooter/asteroid.gd b/demos/2d/space_shooter/asteroid.gd
index 9f6734e122..ab71f413eb 100644
--- a/demos/2d/space_shooter/asteroid.gd
+++ b/demos/2d/space_shooter/asteroid.gd
@@ -10,7 +10,7 @@ var speed_y = 0.0
var destroyed = false
-func _process(delta):
+func _fixed_process(delta):
translate(Vector2(SPEED, speed_y)*delta)
@@ -23,7 +23,7 @@ func destroy():
return
destroyed = true
get_node("anim").play("explode")
- set_process(false)
+ set_fixed_process(false)
get_node("sfx").play("sound_explode")
# Accumulate points
get_node("/root/game_state").points += 1
@@ -34,7 +34,7 @@ func is_enemy():
func _on_visibility_enter_screen():
- set_process(true)
+ set_fixed_process(true)
# Make it spin!
get_node("anim").play("spin")
diff --git a/demos/2d/space_shooter/enemy1.gd b/demos/2d/space_shooter/enemy1.gd
index 204995c05d..e127eb2777 100644
--- a/demos/2d/space_shooter/enemy1.gd
+++ b/demos/2d/space_shooter/enemy1.gd
@@ -7,7 +7,7 @@ const SPEED = -200
var destroyed=false
-func _process(delta):
+func _fixed_process(delta):
get_parent().translate(Vector2(SPEED*delta, 0))
@@ -20,14 +20,14 @@ func destroy():
return
destroyed = true
get_node("anim").play("explode")
- set_process(false)
+ set_fixed_process(false)
get_node("sfx").play("sound_explode")
# Accumulate points
get_node("/root/game_state").points += 5
func _on_visibility_enter_screen():
- set_process(true)
+ set_fixed_process(true)
get_node("anim").play("zigzag")
get_node("anim").seek(randf()*2.0) # Make it start from any pos
diff --git a/demos/2d/space_shooter/enemy2.gd b/demos/2d/space_shooter/enemy2.gd
index cd06579d74..773c266d8c 100644
--- a/demos/2d/space_shooter/enemy2.gd
+++ b/demos/2d/space_shooter/enemy2.gd
@@ -9,7 +9,7 @@ var shoot_timeout = 0
var destroyed=false
-func _process(delta):
+func _fixed_process(delta):
translate(Vector2(SPEED*delta, 0))
shoot_timeout -= delta
@@ -33,18 +33,14 @@ func destroy():
return
destroyed = true
get_node("anim").play("explode")
- set_process(false)
+ set_fixed_process(false)
get_node("sfx").play("sound_explode")
# Accumulate points
get_node("/root/game_state").points += 10
-func _ready():
- set_fixed_process(true)
-
-
func _on_visibility_enter_screen():
- set_process(true)
+ set_fixed_process(true)
func _on_visibility_exit_screen():
diff --git a/demos/2d/space_shooter/rail.gd b/demos/2d/space_shooter/rail.gd
index 7362dff97d..a9559806cb 100644
--- a/demos/2d/space_shooter/rail.gd
+++ b/demos/2d/space_shooter/rail.gd
@@ -7,13 +7,13 @@ var offset = 0
func stop():
- set_process(false)
+ set_fixed_process(false)
-func _process(delta):
+func _fixed_process(delta):
offset += delta*SPEED
set_pos(Vector2(offset, 0))
func _ready():
- set_process(true)
+ set_fixed_process(true)
diff --git a/demos/2d/space_shooter/ship.gd b/demos/2d/space_shooter/ship.gd
index 0bc9ca6b13..d3a4cd335d 100644
--- a/demos/2d/space_shooter/ship.gd
+++ b/demos/2d/space_shooter/ship.gd
@@ -9,7 +9,7 @@ var prev_shooting = false
var killed = false
-func _process(delta):
+func _fixed_process(delta):
var motion = Vector2()
if Input.is_action_pressed("move_up"):
motion += Vector2(0, -1)
@@ -53,7 +53,7 @@ func _process(delta):
func _ready():
screen_size = get_viewport().get_rect().size
- set_process(true)
+ set_fixed_process(true)
func _hit_something():