diff --git a/enemies/walker/walker.tscn b/enemies/walker/walker.tscn index a05bda6..f47b42c 100644 --- a/enemies/walker/walker.tscn +++ b/enemies/walker/walker.tscn @@ -3,10 +3,10 @@ [ext_resource type="Script" path="res://enemies/walker/walker.gd" id="1_walker"] [sub_resource type="RectangleShape2D" id="BodyShape"] -size = Vector2(42, 78) +size = Vector2(34, 62) [sub_resource type="RectangleShape2D" id="AttackShape"] -size = Vector2(50, 60) +size = Vector2(40, 48) [node name="Walker" type="CharacterBody2D" groups=["enemy"]] collision_layer = 4 @@ -36,10 +36,10 @@ monitorable = false shape = SubResource("AttackShape") [node name="FloorProbe" type="RayCast2D" parent="."] -position = Vector2(24, 34) -target_position = Vector2(0, 34) +position = Vector2(19, 27) +target_position = Vector2(0, 27) collision_mask = 1 enabled = true [node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."] -rect = Rect2(-32, -48, 64, 96) +rect = Rect2(-26, -38, 52, 76) diff --git a/player/characters/bassist.tres b/player/characters/bassist.tres index 43e4594..5bcb74c 100644 --- a/player/characters/bassist.tres +++ b/player/characters/bassist.tres @@ -11,5 +11,5 @@ sprite_frames = ExtResource("2_frames") max_health = 100 move_speed = 400.0 jump_velocity = -600.0 -basic_attack_damage = 1 -air_attack_damage = 3 +basic_attack_damage = 5 +air_attack_damage = 10 diff --git a/player/characters/drummer.tres b/player/characters/drummer.tres index 6cb72ca..d90503e 100644 --- a/player/characters/drummer.tres +++ b/player/characters/drummer.tres @@ -11,5 +11,5 @@ sprite_frames = ExtResource("2_frames") max_health = 100 move_speed = 400.0 jump_velocity = -600.0 -basic_attack_damage = 1 -air_attack_damage = 3 +basic_attack_damage = 5 +air_attack_damage = 10 diff --git a/player/characters/guitarist.tres b/player/characters/guitarist.tres index be82356..f3cf29b 100644 --- a/player/characters/guitarist.tres +++ b/player/characters/guitarist.tres @@ -11,5 +11,5 @@ sprite_frames = ExtResource("2_frames") max_health = 100 move_speed = 400.0 jump_velocity = -600.0 -basic_attack_damage = 1 -air_attack_damage = 3 +basic_attack_damage = 5 +air_attack_damage = 10 diff --git a/player/characters/singer.tres b/player/characters/singer.tres index b181d2e..9198ade 100644 --- a/player/characters/singer.tres +++ b/player/characters/singer.tres @@ -11,5 +11,5 @@ sprite_frames = ExtResource("2_frames") max_health = 100 move_speed = 400.0 jump_velocity = -600.0 -basic_attack_damage = 1 -air_attack_damage = 3 +basic_attack_damage = 5 +air_attack_damage = 10 diff --git a/player/player.gd b/player/player.gd index 9f7634b..0cc81cb 100644 --- a/player/player.gd +++ b/player/player.gd @@ -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 diff --git a/player/player.tscn b/player/player.tscn index ddf8c5d..9bedb5c 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -8,7 +8,7 @@ [ext_resource type="PackedScene" path="res://ui/hud/special_charge_hud.tscn" id="6_special_charge_hud"] [sub_resource type="RectangleShape2D" id="PlayerShape"] -size = Vector2(65, 115) +size = Vector2(52, 92) [node name="Player" type="CharacterBody2D" groups=["player"]] z_index = 1 @@ -49,14 +49,14 @@ monitorable = false [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] z_index = -1 -scale = Vector2(0.80251265, 0.8025128) +scale = Vector2(0.64201, 0.64201) sprite_frames = ExtResource("2_frames") animation = &"idle" speed_scale = 2.0 [node name="Camera2D" type="Camera2D" parent="."] scale = Vector2(0.5, 0.5) -zoom = Vector2(2, 2) +zoom = Vector2(2.4, 2.4) script = ExtResource("3_camera") [node name="PlayerHealthHUD" parent="." instance=ExtResource("5_health_hud")]