Download

2D Top Down 8 Directional Movement?

So I am trying out Paper 2D for a prototype I’m working on, but I can’t quite clean up my blueprint for movement and I’m having a error in my logic somewhere (I know where just don’t know what would be better).

If I stop completely then hit a direction it works
if I change direction while moving it works diagonally but I get issues going Up/Down Left/Right if I had gone diagonally it will stick as the diagonal until stopping

I’ll take you through it step by step if you have and suggested changes to clean it up and how to fix the logic that would be immensely helpful:

In the EventGraph I call a custom function to determine the flipbook I should use then set it.

The function determines if the player is moving then finds the direction your facing using a macro then switches flipbooks based on direction and whether or not you are moving.


2.png

Inside the macro things are messy sorry

The macro determines direction by taking velocity and extrapolating the eight directions using this logic: (these are wired correctly)
If Up and not Left or Right then UP
if Down and not Left or Right then Down
if Left and not Up or Down then Left
if Right and not Up or down then Right
if moving Up and Left then UpLeft
if moving Up and Right then UpRight
if moving Down and Left then DownLeft
if moving Down and Right then DownRight

It then sets the direction based on that logic, but if it is all false it outputs the last direction it found (Pretty sure this is causing the logic error)