Layer problem

How do you deal with this:
a) I have 3 types of clones : type 1, type 2, type 3
b) type 1 clones must be drawn in the foreground (i call it layer 1),
type 2 clones must be drawn behind (i call it layer 2) and type 3
clones must be drawn in the background (i call it layer 3)
c) The clones are created in a random order during the game,
moreover, the type is random ...

In snap, layer means drawing order: which means that the number of layers is determined by the number of objects (sprites or clones) to draw on the screen (not exactly but...).

So if 3 clones of type 1, 3 clones of type 2 and 3 clones of type3 are present on the screen, if i add another clone of type 3, i can't "go to front layer" and "go back 3 layer" ; i need to "go to front layer" and "go back 6 (or 9) layer"

How do you deal with that in your projects ?

Would it be possible to help me develop a function goto layer at "My layer 3" (where all type 3 clones are located) (not at layer 3 of Snap) (the function: goto layer 3)

edit:
Solution:
This is an example of the implementation of the solution... I have made the help for each block.

there is a solution, @davidgasku made a Layers system that allows you to put sprites at a certain layer, and have multiple sprites on one layer. I think it's what you want.

Thank's, it work !

I will try something else tomorow... stay tuned!

i use this:

if work in some project but not in my project...

if someone can help...

Tank

"init" is in the stage script

object.....................layer
=====....................====
score engine..........1
ressource monitor..2
panel......................3

clone.....................layer
=====....................====
master....................4
bullet......................4
ressource...............5

That's the problem:
image

image

you have to run
[scratchblocks]
init Layer System::looks
[/scratchblocks]
at the beginning of the project before you use any of the layer blocks.

Yeah, 1st block in the stage scripts

I looked at the project, and I can't seem to figure out what is happening.

same thing for me!

I think it's because of the clones ...

i try this:
image
nothing is happening...

anyone ?

I need help plz !

The problem may be that the init. layer system block may complete after your stretch block. try placing another instance before that script runs.

I think the problem is that it's running the scripts simultaneously. You need to wait until the stage has done that before running the sprite scripts.

the clones are create on the fly...

i will try to create clones in batch, sprite by sprite

Every sprite must be set to layer. Otherwise, the sorting algorithm does not work, and sprites are not reordered accordingly to the layer.

"Init layer..." can be modified but better to set a layer for every sprite.
bug forum - Tank 1.12 script pic (4)
bug forum - Tank 1.12 script pic (6)

Thank's for your time @dardoro, It's very appreciated !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.