How do I switch between layouts?

Get help using Construct 2

Post » Fri Aug 28, 2015 9:26 pm

I have a setting button in the game. When clicked I want to display a menu with multiple buttons.

1. I dont know if the new option screen should be a layout or a sprite.

2. When the option layout appears, does everything keeps running of the game layout? How to pause it?

3. I am using the GO TO LAYOUT to switch between the layout, but this causes the on start layout to run, causing the game ton restart. What is the correct way to switch between the screens of your game?

Thank you.
Posts: 1
Reputation: 152

Post » Fri Aug 28, 2015 9:39 pm

Wow, well here we go:

1. You can use the same layout but the code will need managing better so you don't end up with crazy unmanageable event sheets, I advise you use a new layout if its a small project.

2. The the new layout loads, the old layout will stop and destroy all objects. If you want it to not be destroyed, all the items inside it must be "global" (see object properties). If you want their code to still run, their code must be in a separate event sheet which is also loaded into the new layout.

3. This is the correct way. If you want the game state to persist there are a lot of options, try looking at the "Save" actions and the "Load" actions also the "Global" setting. A lot of solutions here.

Edit: As the below poster recommends Persist behaviour below I agree is better solution. Ignore statement 3.

Hope this helps, let me know if you have any questions.
Last edited by aJamDonut on Fri Aug 28, 2015 9:46 pm, edited 3 times in total.
Stuff I'm working on:
Posts: 88
Reputation: 1,000

Post » Fri Aug 28, 2015 9:40 pm

1. Screens are displayed into layouts, so you can use a layout to display one o more "screens", or use different layouts for different screens. It depends your design. In example, a layout sheet can create and destroy objects and/or show different menus on different cases.
2. Game is paused on windows focusout event but you can handle the pause events by yourself. Please search in forums, it's plenty of info about that.
3. A layout starts each time it's invoked, maybe you want a persistent layout, check then the Persist behavior.
Posts: 40
Reputation: 1,221

Return to How do I....?

Who is online

Users browsing this forum: ivanski1983, KTML5, XavierOrionGames and 5 guests