game: move ui stuff to own folder
This commit is contained in:
18
scenes/managers/ui/player_ui.gd
Normal file
18
scenes/managers/ui/player_ui.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
class_name PlayerUI
|
||||
extends Control
|
||||
|
||||
@onready var hp_bar: ProgressBar = $CenterContainer/VBoxContainer/ProgressBar
|
||||
@onready var elapsed_label: Label = $CenterContainer/VBoxContainer/ElapsedLabel
|
||||
|
||||
func set_hp(value: float):
|
||||
hp_bar.value = value
|
||||
|
||||
func set_elapsed_time(value: float):
|
||||
elapsed_label.text = format_time(value)
|
||||
|
||||
func format_time(seconds: float) -> String:
|
||||
var total_ms = int(seconds * 1000.0)
|
||||
var s = (total_ms / 1000) % 60
|
||||
var m = (total_ms / 60000)
|
||||
|
||||
return "%02d:%02d" % [m, s]
|
Reference in New Issue
Block a user