Add utility strings, update game state with drone count and points calculation.

This commit is contained in:
Dan 2024-05-09 15:42:04 +01:00
parent d879ca30bd
commit 491395e6b9
7 changed files with 105 additions and 5 deletions

View file

@ -1,8 +1,18 @@
extends Control
@onready var time_label = get_node("%TimeSpent")
@onready var drones_label = get_node("%DronesUsed")
@onready var points_label = get_node("%TotalPoints")
func _ready():
visible = false
func _process(_delta):
if GameState.level_complete == true:
update_points()
visible = true
func update_points():
time_label.text = "Time Spent: " + Str.seconds_to_hms(GameState.level_timer)
drones_label.text = "Drones Used: " + str(GameState.drones_used)
points_label.text = "Total Points: " + Str.format_number(GameState.level_points)

View file

@ -8,6 +8,7 @@ var last_update : float = 0
@onready var help_text_container = get_node("%HelpTextContainer")
@onready var help_text_items = help_text_container.get_children()
@onready var level_text_label = get_node("%LevelText")
@onready var level_timer_label = get_node("%LevelTimer")
func _ready():
@ -24,10 +25,12 @@ func _process(delta):
if GameState.level_complete:
update_ui()
level_timer_label.text = Str.seconds_to_hms(GameState.level_timer)
func update_ui():
nectar_bar.value = GameState.gathered_nectar
nectar_bar.max_value = GameState.required_nectar
func hide_help_text():
for item in help_text_items:
item.hide()