(SOLVED) Order of priority in instance code (Basic question)

This might seems like a stupidly basic question, but I need to make sure.
If you have multiple instances of the same object in a room, and
that object "spawns" more of these instances on a grid, it's obvious
you don't want to allow a situation where spawned instances are
spawned on top of each other. I have the object check it's surrounding area,
and if a spot is free an instance is spawned. (quick note: the code is run in a parent object, the actual
instances on the map don't have any code in them, they are children of the parent).

However, this could leave an "overlap". Two instances can check the same spot
and flag it as "spawnable". If they do, they are "forced" to each spawn another instance, in the same spot.

HOWEVER, this won't happen if the order in code priority is run "one at a time".
So: one instance only checks it, then the next instance code is run, then another instance code is run,...
If that's the case, it's fine. Because, one instance flags a spot as "spawnable" then, then the code goes to the next instance, and that next instance can no longer flag that spot as spawnable anymore.

But if for some reason all instances of the same object run their code SIMULTANEOUSLY, this situation might very well occur.

So.. how does it work?
Does a room run its code "instance per instance" or does it go "all instances run parallel".

I'm guessing it's the first one, as that's how code, line per line, works.
 
So I was right? Each instance runs its code line per line, then once that's done the program will go to the next instance in line, run that ones code line by line,... and so on. It would be crucial for what I'm attempting that this is the case ^^
 
Top