summaryrefslogtreecommitdiff
path: root/scripts
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 /scripts
parentde410d4e380ae0c0bc12681242f1dc22b20e9bf8 (diff)
Prevented score from increasing once timer reaches zero.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/hoop.gd1
-rw-r--r--scripts/interface.gd8
2 files changed, 5 insertions, 4 deletions
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))