♻️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

+10 -3
View File
@@ -1,8 +1,8 @@
class_name CombatFX
extends Node2D
## Short-lived world-space effects shared by the player and enemies.
## Pixel shapes only: no particles plugin, imported effect textures or fonts.
## Efectos breves en coordenadas del mundo, compartidos por jugador y enemigos.
## Usan figuras geometricas, sin plugins ni recursos externos de efectos.
var kind: StringName = &"hit"
var direction: float = 1.0
@@ -11,6 +11,7 @@ var _age: float = 0.0
var _lifetime: float = 0.28
## Crea un efecto transitorio en coordenadas globales bajo el padre indicado.
static func spawn(parent: Node, origin: Vector2, effect_kind: StringName,
effect_direction: float = 1.0, effect_radius: float = 54.0) -> void:
if not is_instance_valid(parent):
@@ -23,6 +24,7 @@ static func spawn(parent: Node, origin: Vector2, effect_kind: StringName,
effect.global_position = origin
## Selecciona la duracion visual segun el tipo de efecto.
func _ready() -> void:
z_index = 12
texture_filter = CanvasItem.TEXTURE_FILTER_NEAREST
@@ -37,6 +39,7 @@ func _ready() -> void:
_lifetime = 0.32
## Solicita redibujado hasta agotar la duracion y eliminar el efecto.
func _process(delta: float) -> void:
_age += delta
if _age >= _lifetime:
@@ -45,6 +48,7 @@ func _process(delta: float) -> void:
queue_redraw()
## Genera el efecto segun su tipo y progreso, sin participar en el calculo de dano.
func _draw() -> void:
var progress: float = clampf(_age / _lifetime, 0.0, 1.0)
var fade: float = 1.0 - progress
@@ -53,7 +57,7 @@ func _draw() -> void:
_draw_ring(lerpf(8.0, radius, progress), 0.24, Color(1.0, 0.72, 0.34, fade), 3.0)
_draw_ring(lerpf(3.0, radius * 0.72, progress), 0.32, Color(1.0, 0.94, 0.68, fade), 2.0)
_draw_debris(progress, 16, Color(0.84, 0.71, 0.56, fade), radius)
# Ground cracks appear at the landing point, not attached to the player.
# Las grietas permanecen donde ocurrio el impacto, no se desplazan con el jugador.
for side: float in [-1.0, 1.0]:
var crack := PackedVector2Array([
Vector2(3.0 * side, 0.0), Vector2(14.0 * side, 3.0),
@@ -88,6 +92,7 @@ func _draw() -> void:
draw_rect(Rect2(-8, -3, 16, 6), Color(1.0, 0.98, 0.88, fade))
## Aproxima un anillo eliptico con segmentos de estilo pixelado.
func _draw_ring(ring_radius: float, height_ratio: float, color: Color, width: float) -> void:
var points := PackedVector2Array()
for index: int in range(33):
@@ -106,6 +111,7 @@ func _draw_sparks(progress: float, color: Color, count: int, spread: float) -> v
draw_line(tail, point, color, 2.0)
## Dibuja fragmentos que se separan del punto de impacto.
func _draw_debris(progress: float, count: int, color: Color, spread: float) -> void:
for index: int in range(count):
var side: float = -1.0 if index % 2 == 0 else 1.0
@@ -117,6 +123,7 @@ func _draw_debris(progress: float, count: int, color: Color, spread: float) -> v
draw_rect(Rect2(point.round(), Vector2.ONE * size), color)
## Dibuja una nota musical geometrica sin depender de una fuente.
func _draw_note(point: Vector2, color: Color) -> void:
draw_rect(Rect2(point, Vector2(5, 4)), color)
draw_rect(Rect2(point + Vector2(4, -10), Vector2(2, 13)), color)