revo-jailbreak/objects/hud/hud.gd

53 lines
1.6 KiB
GDScript

extends CanvasLayer
onready var gold_counter = $GoldCounter
onready var shard_counter = $ShardCounter
onready var red_star = $RedStar
onready var yellow_star = $YellowStar
onready var green_star = $GreenStar
onready var blue_star = $BlueStar
onready var magenta_star = $MagentaStar
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
export (Color) var bonus_color
func _ready():
Game.time = 0
func _physics_process(delta):
#Gold Counter
gold_counter.text = "%02d" % Game.golds
#Shard Counter
shard_counter.text = str(Game.shards)
#Star Counter
red_star.visible = Game.stars[0]
yellow_star.visible = Game.stars[1]
green_star.visible = Game.stars[2]
blue_star.visible = Game.stars[3]
magenta_star.visible = Game.stars[4]
#Score Counter
score_counter.text = "%05d" % Game.score
#Arrow Counter
arrow_counter.text = str(Game.arrows)
##TOUCH UP LATER
#Lives counter
lives_counter.text = str(Game.lives)
#Life bonus color
if Game.lives == 2:
lives_counter.modulate = bonus_color
else:
lives_counter.modulate = Color.white
#High counter
high_counter.text = str("HIGH:") + str("%06d" % Game.high_score)
##Timer
Game.time += delta
time_counter.text = Game.timeify(Game.time)
#Time bonus counter
if (Game.has_collection_bonus() && Game.time <= Game.get_map().target_time_100) or (!Game.has_collection_bonus() && Game.time <= Game.get_map().target_time_any):
time_counter.modulate = bonus_color
else:
time_counter.modulate = Color.white