SupaLidlGame/Characters/States/PlayerMoveState.cs

39 lines
936 B
C#
Raw Normal View History

2022-11-13 15:42:04 -08:00
using Godot;
namespace SupaLidlGame.Characters.State
{
public partial class PlayerMoveState : PlayerState
{
[Export]
public CharacterState IdleState { get; set; }
[Export]
public CharacterState RollState { get; set; }
public override CharacterState Enter(CharacterState previousState)
{
Godot.GD.Print("Started moving");
return base.Enter(previousState);
}
public override CharacterState Process(double delta)
{
base.Process(delta);
if (Character.Direction.LengthSquared() == 0)
{
return IdleState;
}
return null;
}
2022-11-18 13:53:51 -08:00
public override CharacterState Input(InputEvent @event)
2022-11-13 15:42:04 -08:00
{
if (@event.IsActionPressed("roll"))
{
return RollState;
}
return null;
}
}
}