How do I get all objects to start pathfinding at the same time?

0 favourites
  • 8 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • I am currently using pathfinding to have objects navigate a course. On path found the objects all move. I'd like a simple way to get them to only start the movement once all objects on the screen have found the path. (Rather than staggered starts as each object finds its path slightly after the one before)

  • Add a boolean instance variable "pathIsFound" to this object. Add this event:

    Object On Path Found -> Object set pathIsFound to true
    
     System Pick all Object
    
     Object boolean pathIsFound is set
     ..System compare two values: Object.Count=Object.PickedCount -> Object move along path
    
  • dop2000

    thanks for the reply. I gave this a try and there is still a little lag between each sprite moving.

    The other issue I have found is that if I do pathfound = move along path it can pick up obstacles blocking the route. If I try and set a variable first it 'forgets' there are obstacles added to the path.

  • Can you post your capx, or a screenshot of the event sheet?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you post your capx, or a screenshot of the event sheet?

    1drv.ms/u/s!Am9ctVZP5a3jiYYcN3s_1mPEyc3Nuw

    Hopefully that should work for you (To download)

    I remade this and having trouble getting your way to work at all now

  • > Can you post your capx, or a screenshot of the event sheet?

    https://1drv.ms/u/s!Am9ctVZP5a3jiYYcN3s_1mPEyc3Nuw

    Hopefully that should work for you (To download)

    I remade this and having trouble getting your way to work at all now

    This works (edit deleted original Pick all event, wasn't needed) , just double checked, and they start at very nearly all the same time, and find path.

    System | Compare Two Values | ai.PickedCount = ai.Count

    side note on your capx, you are better off using 3 individual sprites for the obstacles, as this will be much more efficient than a large image with lots of collision points.

  • Yeah, "pick all" event should should be nested under "path found" event, as it's done on sizcoz's screenshot above. I tried to show it in my first comment, but the new forum kills code formatting...

  • sizcoz dop2000

    Thanks both :) The nesting was the problem. All working now many thanks!!!

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