From eded7976fd532ebfcef746b8e1b9a506cc1636d6 Mon Sep 17 00:00:00 2001 From: tomas7770 <77364520+tomas7770@users.noreply.github.com> Date: Mon, 25 May 2020 00:30:18 +0000 Subject: [PATCH] Disabled SpawnTimer auto-start and enabled one-shot. Fixed rare bug related to timers not performing timeout actions when the game was paused. Updated version to v0.2.2. --- scenes/GlobalVariables.gd | 2 +- scenes/Main.gd | 20 +++++++++----------- scenes/Main.tscn | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/scenes/GlobalVariables.gd b/scenes/GlobalVariables.gd index 5f3e232..ff3ae3c 100644 --- a/scenes/GlobalVariables.gd +++ b/scenes/GlobalVariables.gd @@ -1,6 +1,6 @@ extends Node -const GAME_VERSION = "Development Version (v0.2.1+)" +const GAME_VERSION = "v0.2.2" var high_score = 0 setget highscore_set, highscore_get # Data ID 0 var sound_mute = false setget mute_set, mute_get # Data ID 1 var sound_shift = false setget sfxshift_set, sfxshift_get # Data ID 2 diff --git a/scenes/Main.gd b/scenes/Main.gd index aae9caf..7a4c9c2 100644 --- a/scenes/Main.gd +++ b/scenes/Main.gd @@ -54,19 +54,17 @@ func _physics_process(delta): platX.position.x -= speed*delta func _on_SpawnTimer_timeout(): - if !(GlobalVariables.pause): - var plat = Platform.instance() - add_child(plat) - plat.scale = Vector2(1+randi()%5,min(1+randi()%5,last_height+3)) # 1-5 - last_height = plat.scale.y - plat.position = Vector2(screen_size.x+32*plat.scale.x,screen_size.y-32*plat.scale.y) - $SpawnTimer.start(plat.scale.x/(2.0*(speed/200.0))) + var plat = Platform.instance() + add_child(plat) + plat.scale = Vector2(1+randi()%5,min(1+randi()%5,last_height+3)) # 1-5 + last_height = plat.scale.y + plat.position = Vector2(screen_size.x+32*plat.scale.x,screen_size.y-32*plat.scale.y) + $SpawnTimer.start(plat.scale.x/(2.0*(speed/200.0))) func _on_ScoreTimer_timeout(): - if !(GlobalVariables.pause): - score += 1 - speed += 2 - $HUD.update_score(score) + score += 1 + speed += 2 + $HUD.update_score(score) func _exit_tree(): GlobalVariables.highscore_set(score) diff --git a/scenes/Main.tscn b/scenes/Main.tscn index 2c43088..c6fdebf 100644 --- a/scenes/Main.tscn +++ b/scenes/Main.tscn @@ -14,7 +14,7 @@ position = Vector2( 128, 598 ) [node name="SpawnTimer" type="Timer" parent="."] wait_time = 1.5 -autostart = true +one_shot = true [node name="ScoreTimer" type="Timer" parent="."]