how to change layouts without reseting them

0 favourites
  • 8 posts
From the Asset Store
In this template the music plays without looping in your game
  • 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?

  • 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 store

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • Aridale is correct, choice one should work fine. You should keep to the same layout.

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

  • thanks that helped a lot the store is up and running.

  • 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: https://www.scirra.com/manual/161/persist

    It explains that I need to add persist to each item on the first layout.

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