SOLVED Layer of object when it is created?

H

HyperGolem

Guest
When an object in a certain layer creates another object via instance_create, does the new object appear in the same layer as the object that created it, or does it appear in the most top layer? I feel the latter is happening in my game, a bottom layer object is creating a new object but that new object is above everything else in the room.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
It will be created on the layer that you specify with the function (assuming you are using instance_create_layer and nor instance_create_depth). If the layer you choose (or depth) is the same one as the instance that's doing the creating, then there is no guarantee in which order they will be displayed. If you want to guarantee draw order, then you need to choose specific layers.
 
H

HyperGolem

Guest
It will be created on the layer that you specify with the function (assuming you are using instance_create_layer and nor instance_create_depth). If the layer you choose (or depth) is the same one as the instance that's doing the creating, then there is no guarantee in which order they will be displayed. If you want to guarantee draw order, then you need to choose specific layers.
Oh okay, thanks. I was just using instance_create(x,y,obj).
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
GMS2 has no "instance_create" function (and the topic is tagged GMS2). Is this an imported project from GMS1.4? If so then I strongly recommend that you do a search through the project and change all "instance_create" to instance_create_layer or depth so you have explicit control over what is being created and where.
 
Top