Hi,
Top-down style game.
I have a player sprite with walking animations for left, right, up, and down. I am using a mouse click and pathfinding behavior to move the player. Works like a dream except I am currently only using one animation frame for up, one for down, ignoring left and right. Now it's time to evolve my game and adjust animations based on movement direction.
Problem, since I am using mouse click, is there a way I can mimic the 4 direction movement so I can run an event that adjust the animation to the appropriate direction? What I am experiencing is that if I click 40 pixels down and 20 pixels to the right, it's only showing one movement since it's moving diagonally. So then it got me thinking about mimicking 8 direction movement. However, the question is the same...
I understand that if I used the 4/8 sided movement behavior instead wherein WASD is used, I can easily adjust my animations to show the player moving left, right, up, or down, diagonal. Is there a trick to mimic this using my mouse click event instead of the 4/8 sided behavior?
I was thinking of doing an evaluation constraint based on current location X,Y and the targeted location X,Y and which ever is greater, then use an animation based on that evaluation. Is it as easy as that or is there an optimal way?
Thanks!