0 Favourites

set layers visible one after another - math exp

  • Hi everyone!

    I'm new with the construct2. So probably my question will seem rather silly but...

    I have 15 layers, 3 bottomlayers are visible from the beginning.

    I need to make the layers from 4 visible one by one.

    When player has accomplished his task on one layer the following becomes visible. and so on.

    when the last layer ends the game ends too.

    I use families of objects. On each layer I have the same set of families, but differen objects from the family.

    I need to activate only the objects which are on the layer which is visible at the moment.

    So my guess that I have to operate via:

    System -> set layer visible.

    But I need then to apply the math formula which will set layers visible consiquently from 4-15. From this point I'm lost...

    Could anyone give a hint?

    Thanks in advance!

  • you can do

    System -> Every (x) seconds and replace x with the math formula?

    System -> Set Layer Visible

    Unless I'm understanding you wrong

  • Yes, indeed RamPackWobble, something like that.

    Only I need to stay the layers visible, once shown.

    So by some experimenting - I deleted then the loopindex -> invisible

    And that's working perfect!

    Thanks a lot!

    I have one more question though.

    on each layer I have a number of objects which should be active only when the layer is shown for the first time. before the layer becomes visible or after the following is shown - the objects must stay inactive.

    Could you give a hint on this, please?

  • There was a similar question recently that would be worth reading through (here).

    If you are doing what I think then I would add an instance variable to everything (eg called "ivIAmOnLayer" ?) which could be checked and appropriate action taken ?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • on each layer I have a number of objects which should be active only when the layer is shown for the first time. before the layer becomes visible or after the following is shown - the objects must stay inactive.

    Could you give a hint on this, please?

    I'm not sure how you project is set up, but one idea is that you could put your specific-layer events in different Groups, then activate/deactivate those groups when you change layer visibilities.

    Also, another idea I'm not sure if you ruled out yet.. It almost sounds like you could be using different layouts instead of different layers for your game, since they seem independent from each other..

  • thanks everyone for help! I really apreciate it.

    Was trying to puzzle a bit with all your suggestions, but no luck so far.

    I'll try to describe better what I need.

    1. I have let us say 15 layers.

    2. each layer appears above the previous one and stays.

    3. the change of layers is triggered by putting the Object of the layer in the right position.

    4. all the objects on the layers perform exactly the same actions and have exactly the same set of behaviors. So the only thing that is different from layer to layer is the object itself.

    5. the objects are united in the families on the basis of their behaviors.

    that is why I think that there should be a way to make a general algorithm to describe how EACH OBJECT on Each layer should behave without doing so for each object in particular...

    I don't mind to send a file with the project so that you could see what I'm talking about - that's really just a project for me to learn how...

    dropbox.com/s/cjv38c5l5kilivl/drag-drop-game.capx

    Best regards to everyone :-)

  • Hi,

    I just wanted to thank everyone once again and tell that �'ve found the solution, that was rather easy though...

    1.I have united the objects in families.

    2. I put the condition -is on the Layer- for each object of the family which is involved on the layer

    like

    -family1 - is on the layerX

    -family2 - is on the layerX

    family3 - is on the layerX

    family1 - on drag start

    family1 overlapping family 2 ---> set position to the object and so on...

    So that was pretty easy after all. Special thanks to RamPackWobble who learnt me the trick with Layer global variable.

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