container and z-order

0 favourites
  • 6 posts
  • Have a simple question - How to get the entire container object along with all its constituent objects to the top of the layer without having to rearrange each of constituent objects again to preserve the same z-ordering between container and its constituents as before?

  • By default, all newly created objects are been created at the top of the layer. However, the constituent elements are indeed not appearing in any predetermined order. You can use the "Move to object" action upon creation to control the z-order between the elements in respect to each other.

    See the attached capx for a practical example.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi eli0s, Thanks a lot for putting this capx file. My question was more around - I have multiple instances of container objects and I need to move the selected container ( along with its constituents) to the top. Everytime I move the container to the top, I am needed to move all its constituents again to the top...I wanted to know if there is an easier way to just move the container and its constituents z-order associated with the container is preserved somehow...

  • As far as I can understand there isn't a one click way to do it. But you need to set a system that does that only once.

    I'm not sure what is it that you have in mind, but I tried to devise a situation that you'll need to move all of the elements of a container at once and change the z-depth at the same time. Check the attached capx. Notice that the tanks, while been dragged, they pop on top of the clouds. When dropped they move behind the clouds.

  • Thanks I was doing it in a similar fashion however I had 6 constituents in the container that I had to move...Was thinking if the container and its constituents could be made as a separate object ( as into a family) and just move the family to the top of the layer...However I gather that the family can only hold objects of similar type ( all sprites or all texts etc.,) and not otherwise. Anyway thanks for your help...BTW, I really liked the code for having the clouds moving...fantastic !

  • kmsravindra , you are welcome. I see what you mean. Unfortunately I don't know an other way either. It would be nice indeed if families supported different kind of objects like containers do.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)