forked from team-sg/hero-mark-2
added timer
This commit is contained in:
parent
969364ebce
commit
38ef040ae9
10 changed files with 28 additions and 6 deletions
|
@ -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"
|
||||
|
|
|
@ -110,3 +110,11 @@ margin_right = 152.0
|
|||
margin_bottom = 18.0
|
||||
theme = ExtResource( 10 )
|
||||
text = "0"
|
||||
|
||||
[node name="TimeCounter" type="Label" parent="HUD"]
|
||||
margin_left = 1.0
|
||||
margin_top = 178.0
|
||||
margin_right = 57.0
|
||||
margin_bottom = 198.0
|
||||
theme = ExtResource( 10 )
|
||||
text = "0:00:00"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue