dash hits enemies now

This commit is contained in:
Lilith Schier 2026-07-20 21:06:35 +02:00
parent 26c0c2c9a7
commit 1ba24d1faf
3 changed files with 36 additions and 17 deletions

View file

@ -88,6 +88,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
[Node] private AnimationTree AnimationTree { get; set; } = null!;
[Node] private Area2D SubmersedSensor { get; set; } = null!;
[Node] private Hitbox DashHitbox { get; set; } = null!;
public void OnReady()
{
@ -140,7 +141,11 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
if (CanTurn) AdjustFacing();
if (DashTicker.HasFinishedLastTick) velocity *= 0.6f;
if (DashTicker.HasFinishedLastTick)
{
velocity *= 0.6f;
DashHitbox.StopAttack();
}
if (DashTicker.IsRunning)
{
@ -230,9 +235,9 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
if (IsOnCeiling()) JumpTicker.Reset();
}
public void EnteredWater(Node2D body) => IsInWater = true;
public void OnEnteredWater(Node2D body) => IsInWater = true;
public void LeftWater(Node2D body)
public void OnLeftWater(Node2D body)
{
if (!IsInWater || SubmersedSensor.HasOverlappingBodies()) return;
IsInWater = false;
@ -406,6 +411,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
? FacingVector
: _currentDirection
).Normalized();
DashHitbox.StartAttack();
}
private static Vector2 To8DirectionVector(Vector2 input)