Dodge backward when there's no direction input

I think there’s a more practical way to implement dodge without direction input. Instead of doing nothing (no dodge), automatically dodging backward is better for gameplay, so I redo my OnDodge method like this and it works perfectly. Hope someone finds it helpful.

private void OnDodge()
    {
        if (stateMachine.InputReader.MovementValue == Vector2.zero)
        {            
            stateMachine.SwitchState(new PlayerDodgingState(stateMachine, new Vector2(0f, -1f))); // if no direction input, player dodge behind
        }
        else
        {
            stateMachine.SwitchState(new PlayerDodgingState(stateMachine, stateMachine.InputReader.MovementValue));
        }        
    }
3 Likes

Thanks for posting this. I wound up using it as the FromSoft player in me had to LOL.

1 Like

Privacy & Terms