How do I stop this from happening?

0 favourites
  • 9 posts
  • 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?

  • 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.

  • Thanks That Worked!

  • 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).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • OK! Just wondering, is it possible to cancel the move along path right when food is in LOS?

  • 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.

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

  • Well that would be an issue of your animations, or some extra pathfinding/movement logic maybe..

  • 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.

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