Layers, help needed ...

Get help using Construct 2

Post » Fri Jan 04, 2013 12:12 pm

Hi,
first I may say that I'm an absolutely newbie in the game design/programing field.
I have started using Construct2 some weeks ago (Ilove it) and I try to create a platform game (something similar to Manic Miner).

After some weeks creating layouts and solving troubles by myself (I like to fight by myself usually :P) I have found one that I can't solve without some experienced help :(

I tried to simplify as musch as possible the situation in a capx file but I try to elaborate some more here:

I want to make a PAUSE GAME event. Althought maybe it's not the most elegant way I have managed to get it working nicely.

But after some days I decided to add a GAME OVER screen and then the troubles came.

After you get killed 3 times a GAME OVER screen pops up. Then when you get playing again and presses P to pause the game the layer showing the PAUSE instructions appears behind the main layer even it beeing really in the most top layer :(

Any ideas on how to solve that problem will be more than welcome.

Many thanks in advance,
Ignasi aka Topeich.

CAPX file here: http://dl.dropbox.com/s/758noco1xsw8pui/LAYER_TROUBLE.capx
B
7
S
1
Posts: 7
Reputation: 958

Post » Fri Jan 04, 2013 12:56 pm

Simple solution: Set your 'overlay' object to non-global. It is set as global now and appears in every layout, thus making pausing possible in every layout.

Perhaps better solution (if you intend to use pausing on other layouts) would be to check if active layout is 'game over' at the pausing event. You can do that by checking current layout name (see: https://www.scirra.com/manual/126/system-expressions )

Or perhaps if you have plans for maaany layouts, create global variable 'LayoutAllowsPausing' that is set to 0 or 1 at the start of each layout depending whether that particular layout allows you to use the pause feature. When running the pause event you could check if this variable is 0 or 1 and deny/allow pausing based on that.vee412013-01-04 13:03:01
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Fri Jan 04, 2013 1:18 pm

On the condition "on P pressed" add an action "Move to layer 4" for every object you need on top.
I don't know why restaring the main layout happens this (Honestly, I didn't take a look to the rest of your event sheets) but with those actions it works.
B
11
S
3
Posts: 224
Reputation: 2,028

Post » Fri Jan 04, 2013 1:22 pm

[QUOTE=vee41] Simple solution: Set your 'overlay' object to non-global. It is set as global now and appears in every layout, thus making pausing possible in every layout.[/QUOTE]
That's the idea to use it as global to be able to re-use in every layout of the game.

[QUOTE=vee41]Perhaps better solution (if you intend to use pausing on other layouts) would be to check if active layout is 'game over' at the pausing event. You can do that by checking current layout name (see: https://www.scirra.com/manual/126/system-expressions )

Or perhaps if you have plans for maaany layouts, create global variable 'LayoutAllowsPausing' that is set to 0 or 1 at the start of each layout depending whether that particular layout allows you to use the pause feature. When running the pause event you could check if this variable is 0 or 1 and deny/allow pausing based on that.[/QUOTE]

That's a nice idea, I'll have a look at it as seems a safer way to do it.

But do you think this will help in the layer depth isue?
Many thanks for the answer.
B
7
S
1
Posts: 7
Reputation: 958

Post » Fri Jan 04, 2013 1:28 pm

[QUOTE=Knifegrinder] On the condition "on P pressed" add an action "Move to layer 4" for every object you need on top.
I don't know why restaring the main layout happens this (Honestly, I didn't take a look to the rest of your event sheets) but with those actions it works.[/QUOTE]

Yehaa, simple and working solution!
Many thanks Knifegrinder.
Cheers.
B
7
S
1
Posts: 7
Reputation: 958


Return to How do I....?

Who is online

Users browsing this forum: Televangelist and 20 guests