Path-finding Jump/hop issue

Just started using Construct 2? Post your questions here

Post » Fri Sep 12, 2014 5:30 pm

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: http://youtu.be/-VnTxU3So2M
You do not have the required permissions to view the files attached to this post.
B
8
S
2
G
1
Posts: 19
Reputation: 608

Post » Mon Sep 15, 2014 3:39 pm

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.
Intermediate level Construct 2 developer, looking to build up my portfolio : https://seriouslycrunchy.itch.io/

Current projects : Bite Sized Game Development, please have a look at my tutorials and comment!

I also write for http://moonbooks.net/, please come and check us out!

Follow me on twitter! @SrslyCrunchy I'm always looking for games or templates to highlight, use the hashtag #madeinconstruct !
B
15
S
6
Posts: 52
Reputation: 3,006

Post » Mon Sep 15, 2014 3:44 pm

@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.
Founder of Jadelight Studio, Developer of Libertas Aedifex, regular C2 Help contributor and fan of ambient music and Star Wars.
B
12
S
4
Posts: 255
Reputation: 2,008

Post » Tue Sep 16, 2014 2:06 am

Message: LoneWolfe007 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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: http://youtu.be/BqaSlzTQUa8 also below is two pictures of the code and behavior.
You do not have the required permissions to view the files attached to this post.
B
8
S
2
G
1
Posts: 19
Reputation: 608

Post » Tue Sep 16, 2014 2:11 am

@LoneWolfe007 No worries, I enjoy helping, :). Your YouTube link doesn't work I'm afraid, attaching the .capx would be quicker and easier to assist with, :). 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?).
Founder of Jadelight Studio, Developer of Libertas Aedifex, regular C2 Help contributor and fan of ambient music and Star Wars.
B
12
S
4
Posts: 255
Reputation: 2,008

Post » Tue Sep 16, 2014 3:20 pm

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.
Intermediate level Construct 2 developer, looking to build up my portfolio : https://seriouslycrunchy.itch.io/

Current projects : Bite Sized Game Development, please have a look at my tutorials and comment!

I also write for http://moonbooks.net/, please come and check us out!

Follow me on twitter! @SrslyCrunchy I'm always looking for games or templates to highlight, use the hashtag #madeinconstruct !
B
15
S
6
Posts: 52
Reputation: 3,006

Post » Wed Sep 17, 2014 1:35 am

Message: LoneWolfe007 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
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: http://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.
You do not have the required permissions to view the files attached to this post.
B
8
S
2
G
1
Posts: 19
Reputation: 608


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest