set layers visible one after another - math exp

Get help using Construct 2

Post » Fri Jan 24, 2014 1:03 pm

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!
B
3
Posts: 4
Reputation: 188

Post » Fri Jan 24, 2014 1:21 pm

August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Jan 24, 2014 1:24 pm

you can do
System -> Every (x) seconds and replace x with the math formula?
System -> Set Layer Visible

Unless I'm understanding you wrong
B
4
Posts: 32
Reputation: 268

Post » Fri Jan 24, 2014 2:02 pm

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?sashido2014-01-24 14:04:37
B
3
Posts: 4
Reputation: 188

Post » Fri Jan 24, 2014 3:40 pm

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 ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Jan 24, 2014 4:27 pm

[QUOTE=sashido]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?[/QUOTE]

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..
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Mon Jan 27, 2014 5:00 pm


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...

https://www.dropbox.com/s/cjv38c5l5kilivl/drag-drop-game.capx

Best regards to everyone :-)
B
3
Posts: 4
Reputation: 188

Post » Tue Jan 28, 2014 10:44 am

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.
B
3
Posts: 4
Reputation: 188


Return to How do I....?

Who is online

Users browsing this forum: JarkeyBacon and 8 guests