0 Favourites

Path-finding Jump/hop issue

  • Hello all,

    I am having slight issue and I can't seem to figure it out. What I did in my game was create an enemy which travels to a node that randomly generates in an area. Well everything works except when the enemy reaches the node and the node randomly appears somewhere else, the enemy makes a slight jump or hop before traveling to the new location. I changed the size of the node in hopes that would fix it but it didn't seem to do anything. Does anyone have any tips? Thank you for your help.

    Here is the link to the video of my issue: youtu.be/-VnTxU3So2M

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • By the looks of it its keeping its pathfinding angle/speed after it reaches its goal.

    Try setting the enemy pathfinding speed to 0 during the event 'on pathfinding arrived'. If that doesn't work, I have a workaround that should do the job.

  • LoneWolfe007 A possible alternative solution would be to give the sprite waypoint the LineOfSight behaviour, and then when the NPC gets in range, to use Find Path to another random sprite waypoint. That way, it'd still be travelling along the path and would adjust course without reaching an 'end' and stopping, so you wouldn't have to use On Pathfinding Arrived. This is untested as I'm not at this point in my game yet, but it's how I was planning to do it.

  • Before I comment you both I just wanted to thank you for the help and tips, that is why this is an amazing community.

    @SeriouslyCrunchy No luck with changing the speed, it seemed to still do the same thing.

    @inquiesco I think I understood what you wanted me to do. I added the behavior and it seemed to help some but now instead of a jumping action it is more of a lock into place or click type of action. Here is a quick video of what I mean: youtu.be/BqaSlzTQUa8 also below is two pictures of the code and behavior.

  • LoneWolfe007 No worries, I enjoy helping, . But I think I see your issue.

    You need to move the Enemy -> Find path to (Node.X, Node.Y) Event to after the Node -> Set position to (random(8,630) , random(8,270) ) in the same condition, and then remove your Enemy -> On Pathfinding arrived. This last Event is the issue, I believe. Additionally, you'll need another Enemy -> Move along path Event once the path is found, else they won't follow it (I think?).

  • I can see the video and I would like to know if inquiesco 's solution worked, as it sounds like a winner.

    If it doesn't work, I wonder if changing any other numbers in the pathfinding behaviour would have any effect, or substituting the 'On pathing arrived' with an 'On collision with' for the enemy sprite.

  • I'm sorry I ended up posting before even making sure the link worked.

    @inquiesco I did what you suggested i believe and to me it seems to work. Here is a link to the video and I am pretty sure it works this time: youtu.be/pCPvl9OxmIM I enjoy when the enemy doesn't stop but I can live with this for now until I finish the graphics I assume. I also posted the code just so you can see what I did.

    @SeriouslyCrunchy yeah what inquiesco suggested does seem to work as of right now. I did have to change the area of line of sight on the node because the enemy kept getting stuck on the edges of the screen.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
300 118,427
blackhornet's avatar
blackhornet
Unread hot topic
0 Favourites
Spam issue
201 16,837
Tom's avatar
Tom Construct Team Founder
Unread hot topic
157 12,695
megatronx's avatar
megatronx