So I have created an enemy object and given it pathfinding behavior, with no rotation and no diagonals. I have 4 sprite animations for 4 direction of movement. I want the object to change animations based on which way it is moving i.e play the ‘left’ animation when the object is moving left.
What condition do I use to check which direction the object is moving?
Hi there, I haven’t tried this, but…
When the object is moving, create/modify an object variable of the enemy object and change the value to “Average angle of the forces”. Press the Sigma 123 button to type “force” and find it from there.
If the result is the angle it’s moving, you might be able to check the angle and change animation by the value of the variable.
Thank you for your response. I just tried doing what you said. But it didn’t seem to work. I opened the debugger and checked, but the value never changes.
Thanks for the suggestion. Since I plan on using sprite animations for each direction, I turned off “rotate object” in pathfinding behavior. So angle of object does not give anything.
But that gives me an idea. Maybe I can use an invisible rotating object for pathfinding and make the enemy object follow that invisible object. I will see if that works.
At first I made an object called pathfinder which has no sprites. Then I gave it pathfinding behavior. I disabled diagonal movement since my enemy does not have sprites for it. I also turned the rotation speed up.