I am having some trouble with the instances. You see I have made one object called peds(pedestrians) and made timer to spawn one every 24 seconds. That work fine but when the ped comes up to a collision. Lets say a building play boundary they change their direction which also works but the problem is every ped in the scene changes direction. I left the event screenshot below thanks for the help again.
Firstly, don’t use so many Repeat for each object (they can be processor hogs) and then have conditions. Do the condition first, then (and only if you really must) use a For each object as a subset of the condition. This means rather than going over each instance of the object, you only go over the list that’s filtered down by the condition. And it could be the difference between 1000 iteration loops vs 10.
As it is, for quite a lot of the events you don’t event need a For each object, you can just apply the action to all the objects that met the condition.
So this event can be redone as a plain event, with the collision detection as the condition and the move away from as the action, no For each object needed:
But onto your question. The problem lies with this event:
It makes no sense. The variable walkdirection of every ped will be changed if the green Collision object collides with TJunction, because you haven’t made a link between the condition and the peds objects. How are peds linked to the green Collision box?
thanks for the reply sorry about using so much events :3. They are linked via a point inside the peds object and then the collision object uses a stuck to behavior to keep it in place that the ped doesn’t constantly collide with the object it collides with.
Ok. You’ll need to link the peds and the collision object it belongs to first, and then use the condition to get all peds linked to the collision object when you check for collision with a t-junction.
GDevelop won’t know which peds to apply the actions to otherwise, and it ends up applying the action to all peds (default if there are no conditions filtering it).