Daño aumentado, tamaño de los personajes disminuid

This commit is contained in:
Diego De la Viuda Llorente committed 2026-10-20 13:31:37 +02:00
1 parent eaa6c4e8d3
commit 6d0948022a
7 files changed
+46 -22

No files matched your search

+30 -6
View File
@@ -69,6 +69,18 @@ const ENEMY_HURTBOX_MASK: int = 1 << 4
@export var max_fall_speed: float = 1200.0
@export_category("Double Jump")
## Enables a second jump while in the air.
@export var enable_double_jump: bool = true
## Maximum number of jumps allowed (1 = only ground/coyote, 2 = double jump).
@export_range(1, 2, 1) var max_jumps: int = 2
## Height multiplier applied to the second jump relative to the character's jump force.
@export_range(0.5, 0.95, 0.01) var double_jump_multiplier: float = 0.8
# ============================================================================
# DAMAGE RECEIVED
# ============================================================================
@@ -184,6 +196,8 @@ var ground_pound_active: bool = false
var ground_pound_debug_timer: float = 0.0
var is_dead: bool = false
var jumps_remaining: int = 2
# Tracks the highest point reached since leaving the ground, used to scale
# ground pound damage by jump height instead of fall distance.
var _jump_height_tracking: bool = false
@@ -206,6 +220,8 @@ func _ready() -> void:
if character_data.sprite_frames != null:
animated_sprite.sprite_frames = character_data.sprite_frames
jumps_remaining = max_jumps
_setup_attack_hitboxes()
_update_facing()
_update_animation()
@@ -245,8 +261,10 @@ func _physics_process(delta: float) -> void:
_jump_height_tracking = false
# Landing is only reliable after move_and_slide() has resolved collisions.
if ground_pound_active and not was_on_floor and is_on_floor():
_ground_pound_impact()
if not was_on_floor and is_on_floor():
jumps_remaining = max_jumps
if ground_pound_active:
_ground_pound_impact()
_update_animation()
queue_redraw()
@@ -326,6 +344,7 @@ func _apply_gravity(delta: float) -> void:
func _update_jump_windows(delta: float) -> void:
if is_on_floor():
coyote_timer = coyote_time
jumps_remaining = max_jumps
else:
coyote_timer = max(coyote_timer - delta, 0.0)
@@ -338,12 +357,17 @@ func _update_jump_windows(delta: float) -> void:
func _handle_jump() -> void:
if (
jump_buffer_timer > 0.0
and coyote_timer > 0.0
and not ground_pound_active
):
velocity.y = character_data.jump_velocity
jump_buffer_timer = 0.0
coyote_timer = 0.0
if is_on_floor() or coyote_timer > 0.0:
velocity.y = character_data.jump_velocity
jump_buffer_timer = 0.0
coyote_timer = 0.0
jumps_remaining = max(0, max_jumps - 1)
elif enable_double_jump and jumps_remaining > 0:
velocity.y = character_data.jump_velocity * double_jump_multiplier
jump_buffer_timer = 0.0
jumps_remaining -= 1
if Input.is_action_just_released("jump") and velocity.y < 0.0:
velocity.y *= jump_cut_multiplier