how do i animate a pathfinding object?

so my object is viewed from the side and i would like to flip the sprite according to witch direction he is moving. for up and down changes to different sprite.
is there any function to detect the direction of a object or would i be doing this?

1 Like

Find direction: Conditions → All objects → Movement → Angle of moving
Flip object: Actions → Sprite → Effects → Flip object horizontally / vertically

Although, if you’re doing pathfinding, you probably want a more specific direction. You can do any direction in:

Actions → Sprite → Direction → Change the direction

thank you mats!
i’ve combined platform character with pathfinding object and i’ve limited the direction to right left up dow so it would do just fine so it would do just fine :slight_smile:

Hello there, i’m having the same problem with pathfinding. How did u solve it?

This is how i’d do it with the pathfinder object:
https://drive.google.com/file/d/1koaPz853YgQ_EZc9fr57twC4wGqWPADU/view?usp=sharing

I used a 64x64 Grid and Sprite.
The only problem with this example is the “Moonwalk” thing :slight_smile:

1 Like

Thanks a lot for your reply!!!hahaha moonwalk. My enemies slide like they have rollers :grimacing: I found that way to do that too but it doesn’t useful with diagonals, and the animation is not accompanying the direction of movement :sweat: That is why i’m breaking my brain with this :frowning_face:

1 Like

You can do diagonals with this too, you just need to use 1/2 of the tile dimensions as a condition.

see this updated example:
https://drive.google.com/file/d/1cC3aRIhaqpsNOWkxwb4--Ngb_kfhIHp5/view?usp=sharing

still doesn’t solve the moonwalk issue though LMAO!

edit: updated the zip file, the 5th condition should Jack.Variable(DesY) + 32, not Jack.Variable(DesY) - 32

1 Like

Hahaha lol:joy: Yes, i think that is a solution for this trouble and if a can’t find another i will just use it but i’m looking for something like this example:

pathfinding example

take a look at this, the little (or big) trouble with this is that was made on an older version of gdevelop and it doesn’t work on latest version :grimacing:

1 Like

oh i am aware of that example, i snagged the 3dwall from there lol

It’s a much more elegant way to do pathfinding via a node loop, the only trouble is i have no idea how to do a sprite that have multiple layers nested in one animation line.

Me neither. I think there is a simple way to do something so basic like that on the latest version but i don’t know how.