brackeys-12/ui/counters.gd

43 lines
1.1 KiB
GDScript3
Raw Normal View History

2024-09-14 01:16:14 +00:00
extends Label
@onready var stone_count_label: Label = %StoneCountLabel
@onready var wood_count_label: Label = %WoodCountLabel
@onready var essence_count_label: Label = %EssenceCountLabel
@onready var population_count_label: Label = %PopulationCountLabel
@onready var flood_level_count_label: Label = %FloodLevelCountLabel
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
var stone_count = 1
var wood_count = 2
var essence_count = 3
var population_count = 4
var flood_count = Persister.get_value("flood_level")
if stone_count:
stone_count_label.set_text(str(stone_count))
else:
stone_count_label.set_text(str(0))
if wood_count:
wood_count_label.set_text(str(wood_count))
else:
wood_count_label.set_text(str(0))
if essence_count:
essence_count_label.set_text(str(essence_count))
else:
essence_count_label.set_text(str(0))
if population_count:
population_count_label.set_text(str(population_count))
else:
population_count_label.set_text(str(0))
if flood_count:
flood_level_count_label.set_text(str(flood_count))
else:
flood_level_count_label.set_text(str(0))