Page 1 of 1

Containers of objects which are on different Layers

PostPosted: Sun Mar 06, 2011 6:13 pm
by pooiyx
For example, I have a container with 2 sprites. Each sprite belongs to a different layer on the layout.
If I place (using the GUI, not with events) 1 of the sprites on the layout, is the other sprite supposed to be created automatically? If yes, which layer will it be on?

Is it a bad idea to have containers with objects which are on different layers?
From what I've seen, 1 sprite may be "dragged" into the other sprite's layer. The behaviour seems quite erratic (isn't fixed or well-defined). Is there a smart way to go about doing this? I want to make sure that the objects are always fixed on their own layers (where they are supposed to be), but yet I want the container to be maintained.

Re: Containers of objects which are on different Layers

PostPosted: Sun Mar 06, 2011 6:28 pm
by tulamide
As far as I am aware of, the objects in a container will be created on the same layer. However, something like this should work:
[code:2gv6o1bc]+ Sprite: [negated] Sprite: Is on layer "layername"
-> Sprite: Move to layer "layername"[/code:2gv6o1bc]

When using this, the sprites will only be on the wrong layer for one tick (the one, where they are created)

Re: Containers of objects which are on different Layers

PostPosted: Sun Mar 06, 2011 6:51 pm
by newt
You would be better off having all the objects in the container destroyed on start, and then create one part of the container at start of layout.
Since everything in a container is created if one is, and all contained objects are also picked you could simply tell the specific object what layer to go to.... all in the start of layout event.
Then the only reason it would go to another layer is if you tell it to.