how to change layouts without reseting them

Get help using Construct 2

Post » Thu Jun 21, 2012 8:08 pm

I'm working on my first game and I'm trying to switch between a game layout and a layout for a store (where players can switch weapons). After players leave the store, it resets the main layout to the beginning. Can I make it so that game resumes from where it left off?
Posts: 2
Reputation: 279

Post » Thu Jun 21, 2012 8:19 pm

hmm about this you can make it 1 layout if player clicked on store the store will be in the screen if you want this

if you want to do it in 2 layouts you can do it like this:
if player clicked on store ---> go layout 2
if player clicked exit ---> go layout 1

the first idea can be done in middle of game but 2nd one it must not in the level so when he finish level then he can go to storezsangerous2012-06-21 20:20:45
Posts: 795
Reputation: 11,935

Post » Thu Jun 21, 2012 8:46 pm

Use Global option for this sprite it won't be reset, make sure to set the positions on start layout or another method like variables or dictionary to make the points of position as in and out.
Posts: 3,053
Reputation: 22,640

Post » Thu Jun 21, 2012 9:18 pm

theres 2 ways to go about this

1 - make your store a layer and you can turn it on/off when its needed.

2 - make some way to store everything on the layout before changing to the store layout and then restore it back when going back to the normal layout

the 2nd way is vastly more trouble depending on how complex your layouts are
Posts: 306
Reputation: 3,262

Post » Thu Jun 21, 2012 9:21 pm

Aridale is correct, choice one should work fine. You should keep to the same layout.
Posts: 3,189
Reputation: 32,400

Post » Thu Jun 21, 2012 9:32 pm

I just used the layer approach for making a pause->resume/restart screen and it works like a charm. It's the way I'd go.

EDIT: One thing to keep in mind is that sprites on a hidden layer might still be active, so you may either need to move them off the layout when layer is invisible or test to see if the layer is visible before reacting to them. Testing to see if layer is visible is easiest, but the other way isn't hard if you save off object's position as instance variables.

Also you may need to stop time or counters, so you'd add a test to see if the store screen is invisible before doing some of your statistics keeping.

EDIT 2: The downside of having your store as a layer is that you have to replicate it for every level, which could grow huge! However, keep in mind that you can create the logic that runs your store in a separate event sheet and include it in the level layout. That can simplify things if you have many levels, since you'd just have to maintain the events for the store in one place. You'll have to be the judge if this overhead of duplicating the store layout is just too much to bear.kittiewan2012-06-21 21:41:00
Posts: 281
Reputation: 11,878

Post » Fri Jun 22, 2012 3:58 pm

thanks that helped a lot the store is up and running.
Posts: 2
Reputation: 279

Post » Thu Nov 24, 2016 5:00 pm

Hi, Sorry to drag this topic up. (it's been a few years since these posts so I hope there's an update to fix it)

I'm new to this, I have one layout with so many hidden things (that can still be clicked even though I don't want them to be) so I needed to make a new layout for end turn page showing the scores and a continue button.
When I click continue the first layout resets.
This is what Scirra says about it:
"Go to layout
Switch to another layout in the project. Note that global variables keep their current value - they are not reset. To reset them use the system action Reset global variables."

Is there any way I can keep the new layout and just go back to the first layout without it resetting each time.

Many thanks

EDIT: I found this:

It explains that I need to add persist to each item on the first layout.
Posts: 16
Reputation: 282

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jul, TELLES0808 and 21 guests