cooldowns, sword holstering, ability colors

This commit is contained in:
2026-06-25 00:10:40 +03:00
parent 708a35d51f
commit b929ed2a7a
6 changed files with 268 additions and 124 deletions
+19
View File
@@ -20,6 +20,7 @@ var _toggle_btn: Button
var _spawner: Node
var _player: Node = null
var _cd_overlays: Array[ColorRect] = []
var _cd_labels: Array[Label] = []
var _health_segments: Array[ColorRect] = []
var _health_connected: bool = false
@@ -48,6 +49,13 @@ func _process(_delta: float) -> void:
var ov := _cd_overlays[i]
ov.anchor_top = 1.0 - fraction
ov.anchor_bottom = 1.0
var remaining: float = _player.call(&"ability_cooldown_remaining", i)
var lbl := _cd_labels[i]
if remaining > 0.0:
lbl.text = "%.1fs" % remaining
lbl.visible = true
else:
lbl.visible = false
func _find_spawner() -> void:
@@ -188,6 +196,17 @@ func _build_ability_slot(idx: int) -> Control:
stack.add_child(cd_overlay)
_cd_overlays.append(cd_overlay)
var cd_lbl := Label.new()
cd_lbl.set_anchors_preset(Control.PRESET_FULL_RECT)
cd_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
cd_lbl.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
cd_lbl.mouse_filter = Control.MOUSE_FILTER_IGNORE
cd_lbl.visible = false
cd_lbl.add_theme_color_override("font_color", Color.WHITE)
cd_lbl.add_theme_font_size_override("font_size", 18)
stack.add_child(cd_lbl)
_cd_labels.append(cd_lbl)
var key_lbl := Label.new()
key_lbl.text = _ABILITY_KEYS[idx]
key_lbl.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER