diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/interface.gd | 21 | ||||
-rw-r--r-- | scripts/score_label.gd | 7 | ||||
-rw-r--r-- | scripts/timer_label.gd | 9 |
3 files changed, 34 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() diff --git a/scripts/score_label.gd b/scripts/score_label.gd new file mode 100644 index 0000000..453f468 --- /dev/null +++ b/scripts/score_label.gd @@ -0,0 +1,7 @@ +extends Label + +func _ready(): + text = "Score: " + str(global_variables.score) + +func _on_Hoop_score(): + text = "Score: " + str(global_variables.score) diff --git a/scripts/timer_label.gd b/scripts/timer_label.gd new file mode 100644 index 0000000..7a83ce9 --- /dev/null +++ b/scripts/timer_label.gd @@ -0,0 +1,9 @@ +extends Label + +func _ready(): + $Timer.start() + text = "Time: " + str($Timer.time_left) + +func _process(delta): + text = "Time: " + str($Timer.time_left) + |