Animate player sprite movement with pathfinding

0 favourites
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Amazing, I wasn't expecting it to happen right away you know :) Thanks a lot. Now that I'm looking at the .capx I'm thinking it's no wonder I couldn't figure it out on my own :) Smooth movement logic part is begging to be turned into some kind of plugin. Maybe one day. Also big thanks to Yann. :)

  • Wronghands

    lerping is fairly easy once you get the hang of it (don't be impressed by the size of the expression... size doesn matter you know :D)

  • Could you guys tell me how do you did this? The capx link doesn't work,if you have can you upload it again?

  • Kyatric

    is there a way to accomplish sprite animation using the official path finding behavior? by comparing the direction the object is moving along the path?

    is there an example of that somewhere? would i have to capture the previous x and previous y and compare those with the new x and y and get the direction for that ? or is that a built in way in the official plugin to accomplish this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • this is how i have managed to get it kinda working

    + Enemies: Is Pathfinding moving along path

    -> System: Set angleToNode to angle(​Enemies.​X,​Enemies.​Y,​Enemies.​Pathfinding.​NodeXAt(​Enemies.​Pathfinding.​CurrentNode)​, Enemies.​Pathfinding.​NodeYAt(​Enemies.​Pathfinding.​CurrentNode)​)

    ----+ System: angleToNode is between 0 and 45 degrees

    -----> Enemies: Set animation to "right" (play from beginning)

    ----+ System: Else

    ----+ System: angleToNode is between 46 and 135 degrees

    -----> Enemies: Set animation to "down" (play from beginning)

    ----+ System: Else

    ----+ System: angleToNode is between 136 and 225 degrees

    -----> Enemies: Set animation to "left" (play from beginning)

    ----+ System: Else

    ----+ System: angleToNode is between 226 and 315 degrees

    -----> Enemies: Set animation to "up" (play from beginning)

    ----+ System: Else

    ----+ System: angleToNode is between 316 and 360 degrees

    -----> Enemies: Set animation to "right" (play from beginning)

    but as the enemy approaches the current node his animation start going crazy

  • piranha305 : You can use the MovingAngle expression of the official behavior as long as its speed is >0.

    The "crazyness" likely comes from your angle calculation quickly changing/being unstable when you are almost at the same position as your target.

    In your example, your test is also done every tick the behavior is moving.

    You can refine your animations with the use of condition check of the speed/is moving and possibly the distance with the enemy/arrival node.

  • yes i must have been due to the calculation, i changed it to use the moving angle and its working perfectly thanks!!! i was not aware of that property, i must have overlooked it, but its awesome thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)