lose screen UI; needs animation
This commit is contained in:
parent
28e8a4b6ac
commit
1d0032b587
10 changed files with 300 additions and 45 deletions
File diff suppressed because one or more lines are too long
|
|
@ -1,8 +1,38 @@
|
|||
extends CanvasLayer
|
||||
|
||||
var buildings_destroyed_count := 0
|
||||
var police_eliminated_count := 0
|
||||
var perfect_shot_count := 0
|
||||
|
||||
@onready var score_label: Label = %Score
|
||||
@onready var buildings_destroyed_label: Label = %BuildingsDestroyed
|
||||
@onready var police_eliminated_label: Label = %PoliceEliminated
|
||||
@onready var perfect_shots_label: Label = %PerfectShots
|
||||
@onready var chase_duration_label: Label = %ChaseDuration
|
||||
@onready var distance_traveled_label: Label = %DistanceTraveled
|
||||
|
||||
func update_labels() -> void:
|
||||
score_label.text = str(ScoreLabel.instance.score)
|
||||
|
||||
buildings_destroyed_label.text = str(buildings_destroyed_count)
|
||||
police_eliminated_label.text = str(police_eliminated_count)
|
||||
perfect_shots_label.text = str(perfect_shot_count)
|
||||
|
||||
var delta = Time.get_ticks_msec() - Level.level.start_time_msec
|
||||
var seconds = delta / 1000
|
||||
var minutes = seconds / 60
|
||||
seconds = seconds % 60
|
||||
chase_duration_label.text = "%d:%02d" % [minutes, seconds]
|
||||
|
||||
distance_traveled_label.text = "%dm" % int(roundf(Player.instance.distance_traveled))
|
||||
|
||||
func _on_restart_pressed() -> void:
|
||||
get_tree().reload_current_scene()
|
||||
|
||||
func _on_quit_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
func _ready() -> void:
|
||||
SignalBus.building_destroyed.connect(func(_b, _s): buildings_destroyed_count += 1)
|
||||
SignalBus.enemy_destroyed.connect(func(): police_eliminated_count += 1)
|
||||
SignalBus.perfect_shot_hit.connect(func(): perfect_shot_count += 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue