chore: Move HUD elements to its own node for easy disabling
This commit is contained in:
parent
5d2fd16e87
commit
2497207be8
|
|
@ -19,11 +19,11 @@ func _ready() -> void:
|
|||
$TimeLimit.start()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
$StaminaLabel.text = str(int(stamina))
|
||||
$HUD/StaminaLabel.text = str(int(stamina))
|
||||
|
||||
var time_left = int($TimeLimit.time_left)
|
||||
@warning_ignore("integer_division")
|
||||
$TimeLimitLabel.text = "%02d:%02d" % [time_left/60, time_left]
|
||||
$HUD/TimeLimitLabel.text = "%02d:%02d" % [time_left/60, time_left]
|
||||
|
||||
var dir = Input.get_vector("player_move_left", "player_move_right", "player_move_up", "player_move_down")
|
||||
var speed: float = BASE_SPEED
|
||||
|
|
|
|||
22
player.tscn
22
player.tscn
|
|
@ -42,18 +42,28 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
|
|||
shape = SubResource("CylinderShape3D_i3pqv")
|
||||
debug_color = Color(0.41852123, 0.4635067, 0.996484, 0.41960785)
|
||||
|
||||
[node name="TimeLimitLabel" type="Label" parent="." unique_id=1179212384]
|
||||
[node name="TimeLimit" type="Timer" parent="." unique_id=1568603467]
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
|
||||
[node name="HUD" type="Control" parent="." unique_id=1781259393]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="TimeLimitLabel" type="Label" parent="HUD" unique_id=1179212384]
|
||||
layout_mode = 0
|
||||
offset_left = 10.0
|
||||
offset_top = 10.0
|
||||
offset_right = 110.0
|
||||
offset_bottom = 33.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="TimeLimit" type="Timer" parent="." unique_id=1568603467]
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
|
||||
[node name="StaminaLabel" type="Label" parent="." unique_id=762689230]
|
||||
[node name="StaminaLabel" type="Label" parent="HUD" unique_id=762689230]
|
||||
layout_mode = 0
|
||||
offset_left = 10.0
|
||||
offset_top = 41.0
|
||||
offset_right = 110.0
|
||||
|
|
|
|||
Loading…
Reference in New Issue