DungeonRPG/Scripts/Characters/Player/PlayerMoveState.cs
2025-04-25 01:04:49 -04:00

32 lines
880 B
C#

using Godot;
using System;
using DungeonRPG.Scripts.General;
public partial class PlayerMoveState : PlayerState
{
public override void _PhysicsProcess(double delta)
{
if (characterNode.Direction == Vector2.Zero)
{
characterNode.StateMachine.SwitchState<PlayerIdleState>();
return;
}
characterNode.Velocity = new Vector3(characterNode.Direction.X, 0, characterNode.Direction.Y);
characterNode.Velocity *= 5;
characterNode.MoveAndSlide();
}
public override void _Input(InputEvent @event)
{
if (Input.IsActionJustPressed(GameConstants.INPUT_DASH))
{
characterNode.StateMachine.SwitchState<PlayerDashState>();
}
}
protected override void EnterState()
{
characterNode.AnimatedSprite.Play(GameConstants.ANIM_MOVE);
}
}