M
MarceloP
Guest
Hello guys!
I'm working on a prototype and I've reached a moment where I'd like to create some objects on a Instance Layer. I called "instance_create_layer" and got what I wanted. But since I have more than one thing that will be "dynamically instantiated" I ran into a problem.
When calling "instance_create_layer" you can't tell if the new created object will be draw OVER or UNDER the other objects that were already created. This seems silly, but I don't know in which order my objects will be created and, even if I knew it, I can't set the new instances to be in the drawing order that I want to.
I mean, for simplicity I'd guess that GM probably takes the elements from the layer and draws one after the other, in the sequence they were added to the layer. But no, it seems that (maybe for speed) they actually run it backwards, drawing from the latest added to the first added to the layer, and I can't tell GM to do different.
Some would say for me to create a new layer for every object or better, use depth on everything; but what's the point of a Instance Layer that doesn't allow me to say what comes in front of what? This would only be good for the editor part and, to be real, even make harder for dynamically generated objects to be correctly drawn in those layers.
Layers are a great improvement to GM2, but I do think this layer/depth integration is still way too crude. There should be a better integration of those 2 things in such a way that you could set the depth and still be part of a layer, since it simplifies all matters like setting all elements to invisible, deactivating all elements, and so on...
Anyone has any suggestion in which way I would be able to draw my dynamic instances in a certain order without using the depth system (manually working the depth of all instances)?
I'm working on a prototype and I've reached a moment where I'd like to create some objects on a Instance Layer. I called "instance_create_layer" and got what I wanted. But since I have more than one thing that will be "dynamically instantiated" I ran into a problem.
When calling "instance_create_layer" you can't tell if the new created object will be draw OVER or UNDER the other objects that were already created. This seems silly, but I don't know in which order my objects will be created and, even if I knew it, I can't set the new instances to be in the drawing order that I want to.
I mean, for simplicity I'd guess that GM probably takes the elements from the layer and draws one after the other, in the sequence they were added to the layer. But no, it seems that (maybe for speed) they actually run it backwards, drawing from the latest added to the first added to the layer, and I can't tell GM to do different.
Some would say for me to create a new layer for every object or better, use depth on everything; but what's the point of a Instance Layer that doesn't allow me to say what comes in front of what? This would only be good for the editor part and, to be real, even make harder for dynamically generated objects to be correctly drawn in those layers.
Layers are a great improvement to GM2, but I do think this layer/depth integration is still way too crude. There should be a better integration of those 2 things in such a way that you could set the depth and still be part of a layer, since it simplifies all matters like setting all elements to invisible, deactivating all elements, and so on...
Anyone has any suggestion in which way I would be able to draw my dynamic instances in a certain order without using the depth system (manually working the depth of all instances)?
Last edited by a moderator: