diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/global_variables.gd | 1 | ||||
-rw-r--r-- | scripts/hoop.gd | 2 | ||||
-rw-r--r-- | scripts/interface.gd | 16 |
3 files changed, 12 insertions, 7 deletions
diff --git a/scripts/global_variables.gd b/scripts/global_variables.gd index b570635..3f57f95 100644 --- a/scripts/global_variables.gd +++ b/scripts/global_variables.gd @@ -1,3 +1,4 @@ extends Node var score = 0 +var timer_zero = false diff --git a/scripts/hoop.gd b/scripts/hoop.gd index 61e2b99..c74afe6 100644 --- a/scripts/hoop.gd +++ b/scripts/hoop.gd @@ -6,7 +6,7 @@ var has_scored = false func _on_Area2D_body_exited(_body): # Prevent scoring multiple points with one basketball throw. - if !has_scored: + if !has_scored and !global_variables.timer_zero: global_variables.score += 1 has_scored = true emit_signal ("score") diff --git a/scripts/interface.gd b/scripts/interface.gd index 8aff53b..4a25ce3 100644 --- a/scripts/interface.gd +++ b/scripts/interface.gd @@ -8,14 +8,18 @@ func _ready(): $Timer.start() func _on_Hoop_score(): - if time_left > 0: - $ScoreLabel.text = "Score: " + str(global_variables.score) - time_left += 10 - update_timer() + $ScoreLabel.text = "Score: " + str(global_variables.score) + time_left += 10 + update_timer() func update_timer(): $TimerLabel.text = "Time: " + str(time_left) func _on_Timer_timeout(): - time_left -= 1 - update_timer() + if time_left > 0: + time_left -= 1 + update_timer() + else: + global_variables.timer_zero = true + $Timer.stop() + $Control.visible = true |