I am creating a 2D rpg game with overhead perspective. For the enemies I have sprites with 4 direction animations. In my algorithm the enemies are created outside the camera and move toward the player but, even if I deselect the “allows diagonals” option in the “TopDownMovement” behavior, they move in diagonal. Is there a way to impose only 4 directions movement to the enemies as they move toward the player (i.e. like zig-zag but 90 degrees for the angles)?
How are you making enemies move? Using events?
Yes, after create the enemies they go to the Hero position through an event
How do you do this? What are you using? Forces, physics, pathfinding? Show example of what you’re doing otherwise we can’t help you
This is how I create the enemies, first two sentences create them outside the camera and third sentence moves the enemies toward the player
This is the behavior of the enemies. I deselected the “allow diagonal” options.
You’re not using events of the TopDown Movement behavior to move your objects. Your using built in forces, which are moving the object in a single direction, regardless of the behavior. See:
Instead, you need to simulate key press on the behavior, or use something more appropriate like Pathfinding, or roll your own logic using events and force that are not going directly to the user.
Many thanks for your answer. I will try with one of those methods.