added timer

This commit is contained in:
pennyrigate 2023-01-03 22:38:02 -05:00
parent 969364ebce
commit 38ef040ae9
10 changed files with 28 additions and 6 deletions

View file

@ -11,6 +11,10 @@ onready var score_counter = $ScoreCounter
onready var arrow_counter = $ArrowCounter
onready var lives_counter = $LivesCounter
onready var high_counter = $HighCounter
onready var time_counter = $TimeCounter
func _ready():
Game.time = 0
func _physics_process(delta):
#Gold Counter
@ -26,9 +30,18 @@ func _physics_process(delta):
#Score Counter
score_counter.text = "%06d" % Game.score
#Arrow Counter
arrow_counter.text = "%02d" % Game.arrows
arrow_counter.text = str(Game.arrows)
##TOUCH UP LATER
#Lives counter
lives_counter.text = str(Game.lives)
#High counter
high_counter.text = str("HIGH:") + str("%06d" % Game.high_score)
##Timer
Game.time += delta
var minutes = str(floor(Game.time / 60))
var seconds = floor(fmod(Game.time,60))
var milliseconds := floor(fmod(Game.time, 1) * 100)
if Game.time < 600:
time_counter.text = minutes + ":" + ("%02d" % seconds) + ":" + ("%02d" % milliseconds)
else:
time_counter.text = "9:59:99"