Mejoras en los enemigos

This commit is contained in:
Diego De la Viuda Llorente committed 2026-10-27 11:36:26 +01:00
1 parent 8a5290c5ef
commit 56f9b475b6
12 files changed
+631 -51

No files matched your search

+8 -5
View File
@@ -729,7 +729,7 @@ func _damage_target(collider: Node, damage: int, hit_targets: Dictionary) -> voi
target.take_damage(damage, global_position)
func take_damage(amount: int, source_position: Vector2) -> void:
func take_damage(amount: int, source_position: Vector2, knockback_multiplier: float = 1.0) -> void:
if amount <= 0 or is_dead or invulnerability_timer > 0.0:
return
@@ -751,13 +751,16 @@ func take_damage(amount: int, source_position: Vector2) -> void:
if knockback_direction == 0.0:
knockback_direction = -facing_direction
velocity.x = knockback_direction * damage_knockback.x
velocity.y = -damage_knockback.y
_hurt_animation_timer = 0.18
# Enemy variants choose their push independently of HP damage. Existing
# two-argument calls (hazards, tests) retain the original impulse.
var push_scale: float = clampf(knockback_multiplier, 0.0, 3.0)
velocity.x = knockback_direction * damage_knockback.x * push_scale
velocity.y = -damage_knockback.y * sqrt(push_scale)
_hurt_animation_timer = 0.18 * clampf(push_scale, 1.0, 1.5)
punch_timer = 0.0
ground_pound_active = false
COMBAT_FX.spawn(get_parent(), global_position, &"hit", knockback_direction)
feedback_camera.call("impact", 1.5, 0.18)
feedback_camera.call("impact", 1.5 * clampf(push_scale, 0.8, 1.6), 0.18)
health_changed.emit(current_health, character_data.max_health)