|
|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using Babushka.scripts.CSharp.Common.Services;
|
|
|
|
|
using Babushka.scripts.CSharp.GameEntity.Entities;
|
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
namespace Babushka.scripts.CSharp.Common.CharacterControls;
|
|
|
|
|
@ -8,6 +9,14 @@ public partial class PlayerMovement : CharacterBody2D
|
|
|
|
|
[Export] private float _speed = 1000f;
|
|
|
|
|
[Export] private Timer _stepTimer;
|
|
|
|
|
|
|
|
|
|
private PositionalEntity _entity;
|
|
|
|
|
|
|
|
|
|
public void Initialize(PositionalEntity entity)
|
|
|
|
|
{
|
|
|
|
|
_entity = entity;
|
|
|
|
|
GlobalPosition = entity.position;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void _Process(double delta)
|
|
|
|
|
{
|
|
|
|
|
bool anyActionPressed = false;
|
|
|
|
|
@ -76,6 +85,7 @@ public partial class PlayerMovement : CharacterBody2D
|
|
|
|
|
|
|
|
|
|
Velocity = currentVelocity;
|
|
|
|
|
MoveAndSlide();
|
|
|
|
|
_entity.position = GlobalPosition;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|