How to create an entire hierarchy maintaining layers?

0 favourites
From the Asset Store
Awardkit
$5 USD
Create custom awards and achievement or use the many templates and create your own.
  • I'm making a binding of isaac like game, and I've already put together procedural dungeon generation, but there is a problem. Currently, I'm spawning rooms from a dictionary layout. Each room is parent to a bunch of objects it comes together with (a tilemap, collisions, enemies, etc), but when I create them during generation, every object is put on the same layer instead of in the appropriate ones. I wish Construct would copy them to the exact layers as the layers in both layouts are the same. I probably could make it move everything to the correct layer on creation, but still, isn't there a way to create a composite object, thru hierarchies or containers, the way I want?

  • Currently this is not supported.

    Now that I think about it, maybe an effort could be made to create instances in hierarchies in the corresponding layer. The reason it doesn't work like that is that it can never be guaranteed to work, because the needed layers might not exist in the layout the hierarchy is being created in.

  • Well, it could try, and if any layer doesn't exist, then it could create the objects in the specified layer. Would you be willing to add that? It would be so useful for composite objects. If not, what would be a good approach to this then?

  • I wouldn't wait for this to be implemented on our side, it could take a long time if it even is implemented at all.

    It's difficult to say what a good strategy to do something like what you are describing without seeing how your project looks like. Of the top of my head, you could try having a few families and use that as the mechanism to place the instances in the correct layer.

    Ej. after creating all the instances look for all the instances in the HUD family and place them in the HUD layer.

    Doing something like that for each layer should be convenient in the long run.

  • That's what I thought, thanks for the help. You should really consider that feature tho, I feel like composite objects and these kinds of "interactions" between layouts could have a lot more improvements to as they are today. Keep up the good work!

  • That actually was also on my list BUT specifically with just z-order. It is currently not supported and I think with z-order it should be at least easier to do than with layers. But right now changing the z-order on a template does nothing to the replicas, even when applying a "template -> replace whole" and it's quite inconvenient!

    DiegoM Should I post that to the bugtracker or is that considered a missing feature?

  • You mean changing the Z order by using the context menu option to send to bottom and send to front? Because yeah, that is not supported by templates.

    Right off the bat, I can see that there would be a problem with templates propagating z order to replicas if they are both in the same layer, what should be at the top or the bottom then?

  • Is this the kind of thing that could be solved by dynamically-created global layers appearing just as they look in the editor?

    If this was possible, could you make a global layer for tilemaps, monsters, etc., and then spawn the layers to create a room?

    There's a feature request about this here:

    github.com/Scirra/Construct-feature-requests/issues/84

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm I see the issue with that. But realistically I'd still want the z-order to be somewhat retained in the sense of something being above or below an object. If all the objects in the hierarchy are then, z-order wise, right next to each other that's ok but I think they should be in the right order, so that a sprite that is above another sprite in the template is also above the other sprite in the replica.

  • Oh I see, my misunderstanding. I didn't realize the template's z-order wasn't maintained in replicas, that makes total sense!

  • Hmm I see the issue with that. But realistically I'd still want the z-order to be somewhat retained in the sense of something being above or below an object. If all the objects in the hierarchy are then, z-order wise, right next to each other that's ok but I think they should be in the right order, so that a sprite that is above another sprite in the template is also above the other sprite in the replica.

    I need to check that then, because the relative z ordering in a hierarchy should be kept.

  • Hah so it is a bug! I'll put it in the issue tracker then for tracking purposes.

  • Is this the kind of thing that could be solved by dynamically-created global layers appearing just as they look in the editor?

    If this was possible, could you make a global layer for tilemaps, monsters, etc., and then spawn the layers to create a room?

    There's a feature request about this here:

    https://github.com/Scirra/Construct-feature-requests/issues/84

    but then wouldn't the rooms also be in somewhere in the game layout (and I don't want that) rather than only in the dictionary as they would be global layers?

  • > Hmm I see the issue with that. But realistically I'd still want the z-order to be somewhat retained in the sense of something being above or below an object. If all the objects in the hierarchy are then, z-order wise, right next to each other that's ok but I think they should be in the right order, so that a sprite that is above another sprite in the template is also above the other sprite in the replica.

    I need to check that then, because the relative z ordering in a hierarchy should be kept.

    Doesn't happen to me

  • You can try my exapmle in the tracker

    github.com/Scirra/Construct-bugs/issues/7978

    The template is left, the replica is right. No matter what you do, the blue sprite will be in front of the black sprite despite it being the other way around in the template.

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