tested some platforming mechanics

This commit is contained in:
Lilith Schier 2026-07-20 20:43:42 +02:00
parent 944399ac53
commit 26c0c2c9a7
3 changed files with 15 additions and 12 deletions

View file

@ -76,7 +76,7 @@ attack={
}
dash={
"deadzone": 0.2,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":5,"axis_value":1.0,"script":null)
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

File diff suppressed because one or more lines are too long

View file

@ -51,7 +51,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
public float DashSpeed { get; set; } = 400.0f;
[Export(PropertyHint.None, "suffix:s")]
public float DashCooldownDuration { get; set; } = 0.4f;
public float DashCooldownDuration { get; set; } = 0.6f;
/// <summary>The angle difference from perfect left/right that still counts.</summary>
[Export(PropertyHint.Range, "0,360,0.1,radians_as_degrees")]
@ -140,6 +140,8 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
if (CanTurn) AdjustFacing();
if (DashTicker.HasFinishedLastTick) velocity *= 0.6f;
if (DashTicker.IsRunning)
{
velocity = DashDirection * DashSpeed;
@ -223,7 +225,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
WaterJumpAllowedTicker.Tick(deltaF);
DashTicker.Tick(deltaF);
DashCooldown.Tick(deltaF);
if (IsInWater) DashPoints = Mathf.Min(MaxDashPoints, DashPoints + 1f * deltaF);
if (IsInWater) DashPoints = Mathf.Min(MaxDashPoints, DashPoints + 3f * deltaF);
if (IsOnCeiling()) JumpTicker.Reset();
}
@ -315,8 +317,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
case { Action: Action.Jump, IsPressed: true }
when JumpAllowedTicker.IsRunning
&& (!IsOnFloor() || input.Direction.Y <= 0)
&& !IsInWater:
&& (!IsOnFloor() || input.Direction.Y <= 0):
GroundJump();
return true;
@ -366,8 +367,10 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
{
AdjustFacing();
JumpAllowedTicker.Reset();
Velocity += GetWallNormal() * 200.0f;
Velocity = Velocity with { Y = Mathf.Min(0, Velocity.Y) };
JumpTicker.Duration = JumpAscentMaxDuration;
JumpTicker.Start();
var direction = new Vector2(Mathf.Sign(GetWallNormal().X), -.5f).Normalized();
Velocity = direction * 200.0f;
}
private void JumpCut()