Happy Coding

Checking the direction of movement

Good morning, I have a question regarding this: Pathfinding - Happy Coding. I don’t know how to check which direction an agent is moving (up, down, right, left). I need to know this to create an animation for walking in a certain direction. How can I check it?
PS. I’m new to the forum and libgdx.

If you’re using pathfinding, generally you don’t really need to know the direction the agent is moving, you’d use the current position and calculate a path to a goal.

For the sake of animation, you might look into linear interpolation to move your agent from one point to another. You might also look into trigonometry to make your agent face a certain direction.

The best advice I can give you is to start smaller. If I were you I’d create a small example program that showed an agent moving from one hard-coded point to another. Then work your way up from there.

Good luck!