Added Footsteps SFX
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using Babushka.scripts.CSharp.Common.Inventory;
|
||||
using Babushka.scripts.CSharp.Common.Services;
|
||||
using Godot;
|
||||
|
||||
@@ -7,8 +6,7 @@ namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
||||
public partial class PlayerMovement : CharacterBody2D
|
||||
{
|
||||
[Export] private float _speed = 1000f;
|
||||
|
||||
private InventoryManager _inventoryManager;
|
||||
[Export] private Timer _stepTimer;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
@@ -48,6 +46,21 @@ public partial class PlayerMovement : CharacterBody2D
|
||||
|
||||
anyActionPressed = true;
|
||||
}
|
||||
|
||||
if (Velocity.LengthSquared() == 0 && currentVelocity.LengthSquared() > 0)
|
||||
{
|
||||
_stepTimer.Start();
|
||||
_stepTimer.SetPaused(false);
|
||||
GD.Print("Start");
|
||||
}
|
||||
|
||||
if (currentVelocity.LengthSquared() == 0 && Velocity.LengthSquared() != 0)
|
||||
{
|
||||
_stepTimer.Stop();
|
||||
_stepTimer.SetPaused(true);
|
||||
GD.Print("Stop");
|
||||
}
|
||||
|
||||
|
||||
if (anyActionPressed)
|
||||
{
|
||||
@@ -66,5 +79,9 @@ public partial class PlayerMovement : CharacterBody2D
|
||||
Velocity = currentVelocity;
|
||||
MoveAndSlide();
|
||||
}
|
||||
else
|
||||
{
|
||||
Velocity = Vector2.Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user