♻️REFACTOR: Mejoras en la viabilidad para desarrollo

This commit is contained in:
Diego De la Viuda Llorente committed 2026-10-29 13:23:46 +01:00
1 parent 5aba6c7b47
commit fd0118d964
98 files changed
+5985 -3024

No files matched your search

+7 -9
View File
@@ -1,12 +1,8 @@
extends CanvasLayer
## Minimal player HUD.
##
## This is a CanvasLayer on purpose: its coordinates belong to the camera
## viewport, not to the level. Therefore (18, 18) always means "18 pixels from
## the top-left corner currently visible by the camera", even while the player
## and Camera2D move through the world.
## Interfaz de vida en CanvasLayer: sus coordenadas pertenecen a la ventana,
## no al escenario. Se mantiene en la misma esquina aunque avance la camara.
@onready var health_bar: ProgressBar = $HUD/HealthBar
@onready var health_label: Label = $HUD/HealthBar/HealthLabel
@@ -15,22 +11,23 @@ extends CanvasLayer
var player_ref: Node
## Valida el contrato del jugador y conecta la senal de vida.
func _ready() -> void:
player_ref = get_parent()
if not player_ref.has_signal(&"health_changed"):
push_error("PlayerHealthHUD must be a child of a Player.")
return
# Children enter _ready before Player. Its initial signal arrives afterward.
# Los hijos ejecutan _ready antes que Player; su senal inicial llegara despues de esta conexion.
player_ref.connect(&"health_changed", _on_health_changed)
effects_label.visible = false
## Actualiza los tiempos restantes de las mejoras temporales.
func _process(_delta: float) -> void:
if player_ref == null:
return
# Display each active effect individually: essential when validating all
# eight pickup families on a phone. Property names match Player's timers.
# Muestra cada mejora por separado. Los nombres de propiedades corresponden al estado temporal de Player.
var active: Array[String] = []
var speed_seconds: float = float(player_ref.get("_speed_boost_timer"))
if speed_seconds > 0.0:
@@ -56,6 +53,7 @@ func _process(_delta: float) -> void:
effects_label.text = "\n".join(active)
## Sincroniza barra y texto a partir del mismo par de valores.
func _on_health_changed(current_health: int, max_health: int) -> void:
health_bar.max_value = float(max_health)
health_bar.value = float(current_health)