How do I load a new layout, then return to previous layout

0 favourites
  • 6 posts
From the Asset Store
Create your game with this complete pack of images and animations!
  • This may be an easy question for most of you- but I am still a noob in a lot of ways! I apologize if this has been answered before.

    Question is- If I want to load a new layout at a point in my current layout- use the new one for a bit then return to the previous one from the exact same point- is there a way to do that? Ive tried saving and loading... but that erases everything that was done previously and its like you never did any of it- all global variables are reset to their values at the point of save for example.

    Simple usage of what I am talking about- top down RPG style game, you walk up to a video game console / arcade machine- use it- and you load another game from another layout. Snake for example. In the main game you get some achievement if you play for X amount of time or reach X score- so I want to keep track of that stuff. When the arcade mini-game layout closes I want to be exactly where I was prior with just the variables affected that keep track of these things.

    This is just an example of what I am trying to do- How would you recommend going about something like this? What if my game has multiple instances of this? Ive found lengthy ways around it which is a pain but works- such as setting another variable telling the game that it was last at the video game console, so if it loads that layout with that value true it puts you there- written out like this it doesnt seam like a big deal but it gets tedious when Im doing it so many times. Is there a better way?

    Thanks!

  • In terms of player location on the machine, so it doesn't start from the original game load point, I store player x,y in a global variable when you leave the layout and set player position to these variables when returning to the layout.

    In terms of global variables, they should all be saved if you have 'included' them on each event sheet so that they are used. Even when switching between layouts they are global so should remain the same. Also make sure you don't have any random reset global variable actions in there.

  • great advice- thanks

  • I have a followup question if anybody could share some thoughts-

    Im using a tile-map as a fog-of-war type discovered undiscovered area- its easy enough to remember my X and Y, but is there a way to get the tile map to retain its tile data as well?

    here is what im talking about:

    So if I put the guy in the same spot after an encounter- going in a town or whatever... how do I retain the tile map info? Can you save its current state? I havnt tried yet so it may be easy... im just at work and not looking at it but had this thought. Thanks-

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You might want to check out the persist behavior.

  • You might want to check out the persist behavior.

    haha thanks- if its something really simple and straight forward I apologize- I haven't messed with tilemaps much (obviously) ill check that out

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