added basic ui for dash points
This commit is contained in:
parent
ca4c73191d
commit
944399ac53
4 changed files with 45 additions and 11 deletions
|
|
@ -64,8 +64,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
[Export] public float MaxHealth { get; set; } = 5f;
|
||||
[Export] public float Health { get; set; }
|
||||
[Export] public bool CanTurn { get; set; } = true;
|
||||
|
||||
[Export] public TileMapLayer WaterTileMap { get; set; } = null!;
|
||||
[Export] public float MaxDashPoints { get; set; } = 2f;
|
||||
|
||||
private ulong MaxInputBufferTimeMicroseconds => (ulong)(MaxInputBufferTime * 1_000_000);
|
||||
public bool IsJumping => JumpTicker.IsRunning;
|
||||
|
|
@ -85,7 +84,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
private Ticker DashCooldown { get; } = new();
|
||||
private Ticker JumpTicker { get; } = new();
|
||||
private Vector2 DashDirection { get; set; }
|
||||
private float DashPoints { get; set; }
|
||||
public float DashPoints { get; set; }
|
||||
|
||||
[Node] private AnimationTree AnimationTree { get; set; } = null!;
|
||||
[Node] private Area2D SubmersedSensor { get; set; } = null!;
|
||||
|
|
@ -224,7 +223,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
|||
WaterJumpAllowedTicker.Tick(deltaF);
|
||||
DashTicker.Tick(deltaF);
|
||||
DashCooldown.Tick(deltaF);
|
||||
if (IsInWater) DashPoints = Mathf.Min(2, DashPoints + 1f * deltaF);
|
||||
if (IsInWater) DashPoints = Mathf.Min(MaxDashPoints, DashPoints + 1f * deltaF);
|
||||
|
||||
if (IsOnCeiling()) JumpTicker.Reset();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue