Frontier-of-Hell/scripts/ui/game_stats.gd

42 lines
1.1 KiB
GDScript3
Raw Normal View History

2023-10-07 16:10:06 +02:00
extends Control
2023-10-08 12:45:25 +02:00
signal on_paused()
2023-10-29 08:26:02 +01:00
signal on_fast_forward()
var is_active: bool = false
2023-10-07 16:10:06 +02:00
func set_resource(value):
$Resources/Label.text = str(value)
2023-10-07 17:13:27 +02:00
func set_damage(value):
var health = $Health/GridContainer.get_children()
for x in range(value):
if !health.is_empty():
health[len(health) - 1].queue_free()
health.pop_back()
2023-10-08 12:45:25 +02:00
func _on_pause_button_pressed():
2023-10-25 12:19:35 +02:00
on_paused.emit()
func _on_pause_button_hold():
$Pause/PauseButton.modulate = Color(0.615686, 0.615686, 0.615686, 1)
func _on_pause_button_release():
2023-10-29 08:26:02 +01:00
$Pause/PauseButton.modulate = Color(1, 1, 1, 1)
func _on_fast_forward_button_pressed():
if is_active:
$FastForward/FastForwardButton.set_texture_normal(load("res://assets/icons/fast-forward.png"))
is_active = false
else:
$FastForward/FastForwardButton.set_texture_normal(load("res://assets/icons/fast-forward-active.png"))
is_active = true
on_fast_forward.emit()
func _on_fast_forward_button_hold():
$FastForward/FastForwardButton.modulate = Color(0.615686, 0.615686, 0.615686, 1)
func _on_fast_forward_button_release():
$FastForward/FastForwardButton.modulate = Color(1, 1, 1, 1)