added basic ui for dash points

This commit is contained in:
Lilith Schier 2026-07-18 13:58:23 +02:00
parent ca4c73191d
commit 944399ac53
4 changed files with 45 additions and 11 deletions

View file

@ -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();
}