Containers of objects which are on different Layers

For questions about using Classic.

Post » Sun Mar 06, 2011 6:13 pm

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.
B
5
S
1
G
3
Posts: 59
Reputation: 993

Post » Sun Mar 06, 2011 6:28 pm

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)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sun Mar 06, 2011 6:51 pm

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.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest