8 Directions later...


This is my first 2D top-down game, and it shows 😅

When I started working on Reboot Protocol, I knew it wouldn’t be as simple as it would be my first 2D top-down shooter game, but I didn't expect the 8-directional movement and animation system to be this tricky.

Up until now, I had only worked on 2D platformers or side-scrolling projects with basic left-right animations. This was my first time implementing full 8-directional logic: both movement and animations. It took a surprising amount of time to get things just right—especially syncing the animation transitions and keeping the player’s direction consistent even while idle or shooting. 

The hardest part to me was to ensure my player would hold the last valid diagonal position on Idle state. If you have tried implementing a 8-direction movement before, 2D or 3D, you know how infuriating it is to try to solve this puzzle before you realize that the problem isn't technical, but the simple fact that us humans do not stop pressing two keys on the keyboard (diagonal movement) at the same time, so those miliseconds that you hold only one of those two buttons would make your character to rotate to a cartesian direction. 

If you came to this devlog to get the solution to that, here's how I fixed it: 

  • Use a timer to change from the current direction to the new direction, this will prevent your player from changing directions "by mistake". Based on a quick research, it seems that the average human releases a key after 100ms. I also found out that 100ms is almost imperceptible by our eyes, so it is safe for you to put this time as 0.1f. I tested it and it works just fine.
  • When the player changes the direction, let the character move to that new direction, but only change your animation/official direction after that timer. 
  • This will help you with: 
    • Animation direction
    • Animation while on Idle state
    • Shooting direction while on idle state

Speaking of shooting, one of the most frustrating bugs came from aligning the bullet with the correct firing point based on direction. Sometimes it would spawn at the character’s feet or shoot in the wrong direction entirely. It took multiple iterations of repositioning the FirePoint, rotating it dynamically, and even editing animations to finally make everything feel smooth and intentional.

These were small details, but they added up—and I’m glad I took the time to fix them.

Looking back, it might’ve been faster to go with only 4 directions, but I’m proud I stuck with all 8. It gives the game a more polished feel and made me learn a ton about animation control and character logic in Unity.

Until next time 👾
– Targol

Leave a comment

Log in with itch.io to leave a comment.