How do I make all objects on a single layer solid?

0 favourites
  • 13 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • So I have these layers, and they're invisible, but I want the layers to at some point become visible and I want all objects on that layer to become solid at once. Is there an easy way to do that?

  • If we knew why you want this it would help to give a better answer.

    Layers can be set to be visible or not - I have not used it but that might be your answer ?

    How many objects ? Set a boolean flag for the solid enabled/not ?

  • What does it mean to set a flag?

    Right now my game randomizes the layout of my dungeon room by randomly selecting a pre-designed layout, which has its own dedicated layer, and setting the layer to visible. Unfortunately, it doesn't make the objects solid, obviously, so I need to find a way to (hopefully easily) make all objects in the visible layer solid too. Also, for the purpose of saving memory, I should probably delete all the other invisible objects as well. So... is there a trick for deleting the contents of an entire layer all at once?

    So that's two questions:

    1. Make all objects on a single layer visible

    2. Make all objects on the other random layers deleted

  • Would something as simple as this work?

    If layer is invisible

    Object is on layer

    trigger once

    -set solid behaviour disabled

    if layer is visible

    object is on layer

    trigger once

    -set solid behaviour enabled

  • Thanks for the idea, but I don't think it's going to be that simple. I'm struggling with this... I may have to resort to posting my file later, but I'd feel more comfortable doing it privately if someone with a lot of ability and experience could advise me.

  • Why wouldn't it be this simple?

    And thanks for doubting my ability and experience.. :p

  • Stuff all the desired objects in a family, and when triggered to show the layers also activate the solid state for the family objects.

    Or add a sub to the make layer visible, add event pick all from system, select desired object, and set solid state enabled.

  • lennaert

    You'd have to check if the family members are on the layer, right?

    Else you'd set them solid across all layers.

  • Lennaert

    You'd have to check if the family members are on the layer, right?

    Else you'd set them solid across all layers.

    That depends if he has similair objects on other layers.

    If he has he could easily add an extra check for that.

  • Why wouldn't it be this simple?

    And thanks for doubting my ability and experience.. :p

    Sorry about that inconsiderate comment. I can see that you're very experienced and I'm not. You may very well be correct, but when I tried to implement your suggestion it didn't work. Probably I'm just doing it wrong. I need to find a way to group the objects I think before it'll work.

  • Also, what is meant by "family"

    and yes, I do have multiple instances of the same object on every layer, so that's where the trouble comes.

    Another way might be to create a separate object for each layer and reuse the same sprite and properties, but would that slow my game down? Or would it not have a noticeable effect? Because that seems like the easiest way...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Fanily is a way to group objects, but only objects of the same type.

    You can make a family of sprites and/or a family of tiled-backgrounds, but they can't be part of the same family.

    You can read about it here:

    Manual entry on families

    I'm sure my way would work, with or without families, but families could cut the amount of events down.

    Also you could use Lennaert's way of picking all instances of an object set them to solid disabled, reducing it by adding the condition object is on layer, setting them to solid enabled.

  • Cool, thank you! I think I just don't quite understand the way you suggested earlier. What about "my way"? Would that work/be feasible in terms of memory?

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