mejoras en jugabilidad

This commit is contained in:
Diego De la Viuda Llorente committed 2026-11-11 18:14:14 +01:00
1 parent d983bc2e69
commit ec7e35ddf6
40 files changed
+856 -538

No files matched your search

+41 -13
View File
@@ -1,12 +1,16 @@
@tool
extends Node2D
## La Muerte Espectral: tres barras, patrones fijos y una presentacion animada
## independiente del arte definitivo. Conserva el contrato de enemigo original.
signal died
const PHASE_HEALTH: int = 40
const ARENA_LEFT: float = 3250.0
const ARENA_RIGHT: float = 4200.0
const FLOOR_Y: float = 1270.0
# Zona local respecto a la posicion inicial del jefe. Mover la escena en el
# editor mueve tambien su arena; el rectangulo se fija al empezar el combate.
@export var arena_rect: Rect2 = Rect2(-590.0, -580.0, 950.0, 700.0):
set(value):
arena_rect = value
queue_redraw()
const PATTERNS: Array = [
["sweep", "scythe", "rest"],
["sweep", "scythe", "runes", "rest"],
@@ -26,7 +30,8 @@ var _elapsed: float = 0.0
var _attack: String = ""
var _target: Node2D
var _facing: float = -1.0
var _move_target_x: float = 3840.0
var _move_target_x: float = 0.0
var _arena_world: Rect2
var _projectile_start: Vector2
var _projectile_end: Vector2
var _projectile_pos: Vector2
@@ -50,12 +55,19 @@ var _death_elapsed: float = 0.0
func _ready() -> void:
if Engine.is_editor_hint():
update_configuration_warnings()
queue_redraw()
return
_arena_world = Rect2(to_global(arena_rect.position), arena_rect.size)
visible = true
body.play(&"idle")
_update_hud()
func _process(delta: float) -> void:
if Engine.is_editor_hint():
return
_elapsed += delta
_hit_flash = maxf(0.0, _hit_flash - delta)
if is_dead:
@@ -70,7 +82,7 @@ func _process(delta: float) -> void:
queue_redraw()
return
if not _started:
if _target.global_position.x >= ARENA_LEFT and _target.global_position.y >= FLOOR_Y - 240.0:
if _target.global_position.x >= _arena_world.position.x and _target.global_position.y >= _arena_world.end.y - 240.0:
_started = true
_set_state("rest", 1.5)
$BossHUD.visible = true
@@ -150,22 +162,22 @@ func _begin_next_attack() -> void:
if _attack == "scythe": gap = 240.0
if _attack == "runes": gap = 270.0
if _attack == "dash": gap = 300.0
_move_target_x = clampf(_target.global_position.x - _facing * gap, ARENA_LEFT + 125.0, ARENA_RIGHT - 125.0)
_move_target_x = clampf(_target.global_position.x - _facing * gap, _arena_world.position.x + 125.0, _arena_world.end.x - 125.0)
_set_state("move", clampf(absf(_move_target_x - global_position.x) / (340.0 + 60.0 * phase), 0.28, 1.6))
func _begin_windup() -> void:
_facing = 1.0 if _target.global_position.x > global_position.x else -1.0
if _attack == "runes":
_runes = [clampf(_target.global_position.x, ARENA_LEFT + 75.0, ARENA_RIGHT - 75.0)]
_runes.append(clampf(_runes[0] + (210.0 if _runes[0] < 3750.0 else -210.0), ARENA_LEFT + 75.0, ARENA_RIGHT - 75.0))
_runes = [clampf(_target.global_position.x, _arena_world.position.x + 75.0, _arena_world.end.x - 75.0)]
_runes.append(clampf(_runes[0] + (210.0 if _runes[0] < _arena_world.get_center().x else -210.0), _arena_world.position.x + 75.0, _arena_world.end.x - 75.0))
if _attack == "scythe":
_projectile_start = global_position + Vector2(_facing * 76.0, -37.0)
_projectile_end = Vector2(clampf(_target.global_position.x, ARENA_LEFT + 50.0, ARENA_RIGHT - 50.0), FLOOR_Y - 85.0)
_projectile_end = Vector2(clampf(_target.global_position.x, _arena_world.position.x + 50.0, _arena_world.end.x - 50.0), _arena_world.end.y - 85.0)
_projectile_pos = _projectile_start
if _attack == "dash":
_dash_start = global_position.x
_dash_end = clampf(_target.global_position.x + _facing * 95.0, ARENA_LEFT + 90.0, ARENA_RIGHT - 90.0)
_dash_end = clampf(_target.global_position.x + _facing * 95.0, _arena_world.position.x + 90.0, _arena_world.end.x - 90.0)
_set_state("windup", maxf(0.68, 1.02 - phase * 0.09))
@@ -195,7 +207,7 @@ func _update_active() -> void:
_hurt_player()
"runes":
for x: float in _runes:
if absf(_target.global_position.x - x) < 65.0 and _target.global_position.y > FLOOR_Y - 160.0:
if absf(_target.global_position.x - x) < 65.0 and _target.global_position.y > _arena_world.end.y - 160.0:
_hurt_player()
@@ -329,6 +341,13 @@ func _update_visuals() -> void:
func _draw() -> void:
if Engine.is_editor_hint():
# Vista previa en coordenadas locales: el rectangulo no sigue al jefe
# durante la pelea, solo a su posicion inicial al colocar la escena.
draw_rect(arena_rect, Color(0.44, 0.88, 1.0, 0.85), false, 3.0)
draw_line(Vector2(arena_rect.position.x, arena_rect.end.y),
Vector2(arena_rect.end.x, arena_rect.end.y), Color(1.0, 0.6, 0.2, 0.9), 3.0)
return
var aura: Color = Color(0.35, 0.86, 0.85) if phase == 0 else (Color(0.69, 0.39, 1.0) if phase == 1 else Color(1.0, 0.30, 0.43))
var bob: float = sin(_elapsed * 2.3) * 7.0
var shimmer: float = 0.65 + 0.35 * sin(_elapsed * 3.5)
@@ -339,7 +358,7 @@ func _draw() -> void:
draw_circle(Vector2(cos(a) * r, -45.0 + sin(a) * r - _death_elapsed * 35.0), 4.0 + i % 3, Color(0.59, 0.95, 0.88, maxf(0.0, 0.85 - _death_elapsed * 0.65)))
return
# Silueta flotante y sombra sobre el suelo: su desplazamiento es visible.
draw_circle(Vector2(0.0, FLOOR_Y - global_position.y), 48.0, Color(0.02, 0.01, 0.045, 0.28))
draw_circle(Vector2(0.0, _arena_world.end.y - global_position.y), 48.0, Color(0.02, 0.01, 0.045, 0.28))
draw_circle(Vector2(0.0, -38.0 + bob), 120.0, Color(aura.r, aura.g, aura.b, 0.07 + shimmer * 0.035))
for i: int in range(5):
var theta: float = _elapsed * 0.8 + float(i) * TAU / 5.0
@@ -391,7 +410,7 @@ func _draw() -> void:
func _draw_runes(active: bool, aura: Color) -> void:
for x: float in _runes:
var center: Vector2 = to_local(Vector2(x, FLOOR_Y - 5.0))
var center: Vector2 = to_local(Vector2(x, _arena_world.end.y - 5.0))
var ring_color: Color = Color(1.0, 0.33, 0.38, 0.9) if active else Color(aura.r, aura.g, aura.b, 0.85)
draw_arc(center, 57.0, 0.0, TAU, 32, ring_color, 6.0)
draw_line(center + Vector2(-42.0, 0.0), center + Vector2(42.0, 0.0), ring_color, 4.0)
@@ -399,3 +418,12 @@ func _draw_runes(active: bool, aura: Color) -> void:
draw_line(center + Vector2(20.0, -25.0), center + Vector2(-20.0, 25.0), ring_color, 4.0)
if active:
draw_rect(Rect2(center + Vector2(-60.0, -170.0), Vector2(120.0, 170.0)), Color(1.0, 0.25, 0.36, 0.25))
func _get_configuration_warnings() -> PackedStringArray:
var warnings := PackedStringArray()
if arena_rect.size.x < 350.0 or arena_rect.size.y < 300.0:
warnings.append("Arena Rect demasiado pequena para los desplazamientos y ataques del jefe.")
if arena_rect.size.x <= 250.0:
warnings.append("El ancho debe superar los margenes de movimiento de ambos lados.")
return warnings