Menus de muerte pausa y personajes renovados
This commit is contained in:
1 parent
97335c9d21
commit
6a267b2cf4
54 files changed
+14033
-3170
No files matched your search
@@ -156,7 +156,7 @@ var drops_handled_by_level: bool = false
|
||||
@onready var attack_collision: CollisionShape2D = $AttackHitbox/CollisionShape2D
|
||||
@onready var floor_probe: RayCast2D = $FloorProbe
|
||||
@onready var visibility_notifier: VisibleOnScreenNotifier2D = $VisibleOnScreenNotifier2D
|
||||
@onready var visual: Sprite2D = $Visual
|
||||
@onready var visual: AnimatedSprite2D = $Visual
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -222,6 +222,7 @@ func _ready() -> void:
|
||||
|
||||
_update_facing()
|
||||
_reset_attack_hitbox_position()
|
||||
visual.play(&"idle")
|
||||
queue_redraw()
|
||||
|
||||
|
||||
@@ -242,6 +243,7 @@ func _physics_process(delta: float) -> void:
|
||||
if not is_awake:
|
||||
velocity.x = 0.0
|
||||
move_and_slide()
|
||||
_update_actor_animation()
|
||||
queue_redraw()
|
||||
return
|
||||
|
||||
@@ -249,6 +251,7 @@ func _physics_process(delta: float) -> void:
|
||||
if target == null:
|
||||
velocity.x = 0.0
|
||||
move_and_slide()
|
||||
_update_actor_animation()
|
||||
queue_redraw()
|
||||
return
|
||||
|
||||
@@ -263,6 +266,7 @@ func _physics_process(delta: float) -> void:
|
||||
velocity.x = move_toward(velocity.x, 0.0, knockback_strength * delta)
|
||||
|
||||
move_and_slide()
|
||||
_update_actor_animation()
|
||||
queue_redraw()
|
||||
return
|
||||
|
||||
@@ -273,6 +277,7 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
move_and_slide()
|
||||
_update_jump_visual()
|
||||
_update_actor_animation()
|
||||
queue_redraw()
|
||||
|
||||
|
||||
@@ -483,6 +488,27 @@ func _find_jump_landing(destination: Vector2, max_rise: float, gravity_y: float,
|
||||
return best_landing
|
||||
|
||||
|
||||
## Las piernas de los enemigos se animan segun velocidad y estado de la IA.
|
||||
## Es puramente visual: ataque, hitboxes, navegacion y tiempos permanecen intactos.
|
||||
func _update_actor_animation() -> void:
|
||||
var animation: StringName = &"idle"
|
||||
if is_dead:
|
||||
animation = &"death"
|
||||
elif hit_stun_timer > 0.0:
|
||||
animation = &"hurt"
|
||||
elif attack_state != AttackState.IDLE:
|
||||
animation = &"attack"
|
||||
elif not is_on_floor():
|
||||
animation = &"jump"
|
||||
elif absf(velocity.x) > 7.0:
|
||||
animation = &"walk"
|
||||
if visual.sprite_frames == null or not visual.sprite_frames.has_animation(animation):
|
||||
return
|
||||
visual.speed_scale = clampf(absf(velocity.x) / maxf(move_speed, 1.0), 0.7, 1.4) if animation == &"walk" else 1.0
|
||||
if visual.animation != animation:
|
||||
visual.play(animation)
|
||||
|
||||
|
||||
## Orienta ligeramente el sprite durante el vuelo sin cambiar su colision.
|
||||
func _update_jump_visual() -> void:
|
||||
if not _jump_in_progress:
|
||||
@@ -727,6 +753,7 @@ func _die() -> void:
|
||||
velocity = Vector2(_last_hit_direction * 150.0, -210.0)
|
||||
COMBAT_FX.spawn(get_parent(), global_position, &"death", _last_hit_direction)
|
||||
# La muerte logica y su senal ocurren una sola vez; la animacion no retrasa las recompensas.
|
||||
_update_actor_animation()
|
||||
died.emit()
|
||||
|
||||
# Los encuentros de laboratorio entregan su objeto asignado; el resto conserva su tabla aleatoria.
|
||||
|
||||
Reference in new issue
Block a user