summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLogan <logan@cflip.net>2022-09-26 18:50:01 -0600
committerLogan <logan@cflip.net>2022-09-26 18:50:01 -0600
commit213c859794722954177f1b516083b6313e084f00 (patch)
tree444d4939ce7398ba506fff9bb54e94b3c21ee002
parentde410d4e380ae0c0bc12681242f1dc22b20e9bf8 (diff)
Prevented score from increasing once timer reaches zero.
-rw-r--r--scenes/interface.tscn1
-rw-r--r--scripts/hoop.gd1
-rw-r--r--scripts/interface.gd8
3 files changed, 6 insertions, 4 deletions
diff --git a/scenes/interface.tscn b/scenes/interface.tscn
index 526db54..b99b28f 100644
--- a/scenes/interface.tscn
+++ b/scenes/interface.tscn
@@ -20,6 +20,7 @@ rect_scale = Vector2( 0.15, 0.15 )
[node name="Timer" type="Timer" parent="Timer Label"]
wait_time = 30.0
+one_shot = true
[node name="Update Timer" type="Timer" parent="."]
diff --git a/scripts/hoop.gd b/scripts/hoop.gd
index dc43cc1..aba0b2b 100644
--- a/scripts/hoop.gd
+++ b/scripts/hoop.gd
@@ -9,5 +9,4 @@ func _on_Area2D_body_exited(_body):
# Prevent scoring multiple points with one basketball throw.
if !global_variables.has_scored:
global_variables.has_scored = true
- global_variables.score += 1
emit_signal ("score")
diff --git a/scripts/interface.gd b/scripts/interface.gd
index 138527d..f4b728d 100644
--- a/scripts/interface.gd
+++ b/scripts/interface.gd
@@ -11,9 +11,11 @@ func _ready():
$"Update Timer".start()
func _on_Hoop_score():
- score_label.text = "Score: " + str(global_variables.score)
- timer.start(timer.get_time_left() + 10)
- update_timer()
+ if timer.get_time_left() > 0:
+ global_variables.score += 1
+ score_label.text = "Score: " + str(global_variables.score)
+ timer.start(timer.get_time_left() + 10)
+ update_timer()
func update_timer():
timer_label.text = "Time: " + str(round(timer.time_left))