How do I stop this from happening?

Get help using Construct 2

Post » Wed Feb 11, 2015 11:00 pm

I am working on a game where ants are randomly wandering and when they are close to food, they collect it. After a while of wandering, the ant randomly stops. I used the debugger and it said it was moving, but the speed was 0. How To Fix?
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 8
Reputation: 304

Post » Wed Feb 11, 2015 11:10 pm

add condition

(X)PlayerAnt | Is Pathfinding moving along path
(x = inverted)

after
PlayerAnt | Has LineOfSight to Food

Not sure if it's a full solution but might help.

Also I think you can remove the For Eaches, except for the On start of layout one.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Feb 11, 2015 11:14 pm

Thanks That Worked!
B
5
Posts: 8
Reputation: 304

Post » Wed Feb 11, 2015 11:20 pm

Awesome. BTW I added a bunch more ants and it seems to work ok but some of the pathfinding seemed a bit weird. Also I'd actually put that new condition first in order (not sure if it makes much difference though).
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Feb 11, 2015 11:28 pm

OK! Just wondering, is it possible to cancel the move along path right when food is in LOS?
B
5
Posts: 8
Reputation: 304

Post » Wed Feb 11, 2015 11:33 pm

You could issue a pathfinding 'stop' action. Pathfinding is easy to get something going quickly but you have to allow for a lot of cases :) Good luck.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Feb 11, 2015 11:38 pm

One more thing, is it possible to make it so that the ants wont stay on the spot and rotate? It looks unnatural.
B
5
Posts: 8
Reputation: 304

Post » Thu Feb 12, 2015 1:17 am

Well that would be an issue of your animations, or some extra pathfinding/movement logic maybe..
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Mon Feb 16, 2015 7:47 pm

anthony200229 wrote:One more thing, is it possible to make it so that the ants wont stay on the spot and rotate? It looks unnatural.


What you could do is set the ant to stop moving when within X pixels of a food source, this would prevent the ant from going right over top of the food and spin over it. Include the gather food in this condition so when the ant stops, it gathers the food, and moves onto either the next food source, continues wandering, or returns to the mound with the food.
B
5
Posts: 22
Reputation: 271


Return to How do I....?

Who is online

Users browsing this forum: Magistross, zenox98 and 10 guests