add timer to the ui (#8)

Reviewed-on: #8
Co-authored-by: 3002102 <3002102@stud.hs-mannheim.de>
Co-committed-by: 3002102 <3002102@stud.hs-mannheim.de>
pull/9/head
Jaro Winkelhausen 2026-04-15 18:14:52 +02:00 committed by Jaro Winkelhausen
parent e46b196f71
commit fc40a5c368
2 changed files with 23 additions and 5 deletions

View File

@ -1,11 +1,11 @@
extends Node2D
@onready var _timer_label: Label = $CanvasLayer/TimerLabel
@onready var _spawn_control = $SpawnControl
# Called when the node enters the scene tree for the first time.
func _ready():
MusicManager.play(preload("res://assets/music&sfx/music/ashveil-355633.mp3"))
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _process(_delta: float) -> void:
var t = int(_spawn_control.elapsed_time)
_timer_label.text = "%02d:%02d" % [t / 60, t % 60]

View File

@ -2436,6 +2436,24 @@ patch_margin_top = 5
patch_margin_right = 8
patch_margin_bottom = 6
[node name="TimerLabel" type="Label" parent="CanvasLayer" unique_id=1111111111]
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -60.0
offset_top = 31.0
offset_right = 60.0
offset_bottom = 55.0
grow_horizontal = 2
text = "00:00"
horizontal_alignment = 1
theme_override_fonts/font = ExtResource("19_1kice")
theme_override_font_sizes/font_size = 20
theme_override_colors/font_color = Color(1, 1, 1, 1)
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
theme_override_constants/shadow_offset_x = 1
theme_override_constants/shadow_offset_y = 1
[node name="LevelUpManager" type="Control" parent="CanvasLayer" unique_id=292400493]
process_mode = 3
layout_mode = 3