summaryrefslogtreecommitdiff
path: root/scripts/interface.gd
diff options
context:
space:
mode:
authorLogan <logan@cflip.net>2022-09-26 11:15:14 -0600
committerLogan <logan@cflip.net>2022-09-26 11:15:14 -0600
commitec3b1f444db16ebfbbde48e20be3b92500762a57 (patch)
tree50c0ee5ca0576b9fea8039c3952db8517d185967 /scripts/interface.gd
parentedb36b840a32f5b9cd799d709a747edc1bb622a8 (diff)
Add countdown timer.
Diffstat (limited to 'scripts/interface.gd')
-rw-r--r--scripts/interface.gd21
1 files changed, 18 insertions, 3 deletions
diff --git a/scripts/interface.gd b/scripts/interface.gd
index 453f468..138527d 100644
--- a/scripts/interface.gd
+++ b/scripts/interface.gd
@@ -1,7 +1,22 @@
-extends Label
+extends Control
+
+onready var timer_label = $"Timer Label"
+onready var timer = $"Timer Label/Timer"
+onready var score_label = $"Score Label"
func _ready():
- text = "Score: " + str(global_variables.score)
+ score_label.text = "Score: " + str(global_variables.score)
+ timer.start()
+ timer_label.text = "Time: " + str(timer.time_left)
+ $"Update Timer".start()
func _on_Hoop_score():
- text = "Score: " + str(global_variables.score)
+ 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))
+
+func _on_Update_Timer_timeout():
+ update_timer()