tested some platforming mechanics
This commit is contained in:
parent
944399ac53
commit
26c0c2c9a7
3 changed files with 15 additions and 12 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue