How to resume game after exiting?

ancchancch Member, PRO Posts: 103
edited November -1 in Working with GS (Mac)
If my game has 50 scenes, how can I allow a user to exit the game and return to the game later at the last played scene?

Comments

  • design219design219 Member Posts: 2,273
    You would need to have an attribute that records the scene a player is on, and a rule to save that attribute when the scene is entered. Then, you could have a button with an option to return to the last scene played when the game is relaunched.

    _______________

    Nesen Probe http://itunes.apple.com/us/app/nesen-probe/id377766693?mt=8
    Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
    
Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
  • ancchancch Member, PRO Posts: 103
    Thanks for the quick reply! Will read through
  • ancchancch Member, PRO Posts: 103
    Still working at this... How can I create a button with option to return to the last scene played when the game is relaunched?

    I used "Change Scene", but there is no option for me to change to the last scene played before exiting. Only available options are previous scene and next scene...
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi ancch, you'll need a continue game button next to the new game button in your menu level. You'll have to decide if you want a Save button as part of the HUD on each level, or a save button on the menu level, and a return to menu button as part of the HUD, appearing on every level. Whichever is used, when Save is pressed, you need to use Save Attribute Behaviour to save the level as well as any other attributes that have changed.

    Then in your continue game button, you use Load Attribute Behaviours, loading in all of the attributes saved at the last place in the game. Finally, Rules showing if attribute is Lev3, go to level 3, etc.
    This last bit you asked about only, but thought I'd give you more info in case you didn't know. Anyhow, hope it helps.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • RiffelRiffel Member Posts: 1,272
    Taking advantage of the topic, when saved each attribute in a save key that worked. I tried to save several attributes in the same save key and has not worked. In my case the levels of the game.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Riffel, I think always use a different key for each and every Save Attribute.

    To amend & clarify what I was trying to say above, I think you'll only need 1 Save Attribute for the level saved, called LevelSave for instance, any key you like. With the continue Button, Load LevelSave, and if it's 1 then go to level 1, if it's 2, then to level 2, etc. Before any of these, load in any other changed atributes as well.

    :-)

    Edit: written much of what design219 said....

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • RiffelRiffel Member Posts: 1,272
    Ok, thanks, tonight I will do some steps back...
  • ChaserChaser Member Posts: 1,453
    Aside from making unlocked levels you can put a game attribute interger and call it something like current level continue. Start at 0 or 1 then at each level add 1 to the game attribute and save. Then at level screen aside from unlocked levels have a continue button and a load behavior so that when level 15 or 18 or whatever load scene whatever.
    Anyway I guess I saying the same thing everybody else is saying
  • ancchancch Member, PRO Posts: 103
    Thanks guys! That means if I have 50 levels, I will need 50 goto scene lines? Wow. Any better way?
  • design219design219 Member Posts: 2,273
    Yes, I'm afraid so.

    It should be something like this. You first need to create a global attribute named SCENE. It needs to be an integer.

    Each scene should have one actor with the rule:

    Change attribute SCENE to 47 (or whatever the scene number is).
    Save attribute SCENE

    You really don't need a button for the save part, just add it to the change rule, but make sure it comes after the change scene number attribute.

    This will make sure you game is always saving the latest scene.

    Now when someone relaunches the game, you could have a button actor that will take a player to the last scene played. It's will need a rule for each level, but you can copy and paste and then just change the number. It should look sort of like this:

    If attribute SCENE is 1
    Change scene to 1(or the whatever you have named your scene 1)

    If attribute SCENE is 2
    Change scene to 2(or the whatever you have named your scene 2)

    And on to 50.

    There might be a simpler way, but this will work.

    Best of luck!

    _______________

    Nesen Probe http://itunes.apple.com/us/app/nesen-probe/id377766693?mt=8
    Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
    Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    Tutorial here.
    Actually maybe more of a shortcut to avoid having to put an instanced actor in every scene.

    http://gamesalad.com/forums/topic.php?id=6824#post

    http://gamesalad.com/forums/topic.php?id=6824#post
  • design219design219 Member Posts: 2,273
    Wow, James, that kicks butt! Well done.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Also, Saving and Loading of Attributes only works on the device itself. And only in a published App - either a Development Build or a Distribution Build.

    It will not work in the GameSalad Preview or in the GS Viewer.
  • quantumsheepquantumsheep Member Posts: 8,188
    firemaplegames said:
    It will not work in the GameSalad Preview or in the GS Viewer.

    This is slightly innacurate. It will work on the GS Viewer.

    Test your game on the GS Viewer - play it, shut it down etc.

    Then go back into the GS Viewer, click 'recent games' - play the game you just tested.

    Your attributes will work just fine.

    Cheers,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Oooh! That's good to know!
    That GS Viewer keeps getting cooler!
    Thanks QS!
  • quantumsheepquantumsheep Member Posts: 8,188
    It's very cool!

    I have various iterations of my games - so
    Project K 1-1
    Project K 1-2

    etc etc

    as I add new features, I save as a different version.

    Therefore, any save data is lost as you've effectively made a new game with each version.

    Now, one way to keep checking the save variable changes across all versions would be to save out a copy of your game as a test.

    So, I'm on Project K 2-3. I test it, get a certain way through, and it saves the data,
    I then make Project K 2-4, and the save data is gone from 2-3.

    So, save as Project K TEST - and you should retain all the save data from previous versions as you're always testing that version.

    Make sense?

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    So the GS Viewer is what you get when you've paid your $99? (soon Gendai, I promise...) Is it straightforward to use?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • quantumsheepquantumsheep Member Posts: 8,188
    Once set up, it's brilliant.

    You just press the icon on your iPhone, and 'iPhone' graphic appears next to the big green arrow in GameSalad.

    You just click that to send to your iPhone, and it's there in your hand.

    Possibly one of the most wonderful things you'll ever see :D

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Thanks for the info, QS. Excellent; sounds....excellent! Really, sounds very straightforward.

    Right, I'd better get back to the neighbours' barbeque; only came back to feed and water the dog; then inevitably fell asleep for an hour and a half...no more burgers for me, then...

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • design219design219 Member Posts: 2,273
    quantumsheep said:
    Once set up, it's brilliant.

    True, but the setup is a little tricky. You need to follow the directions very carefully. Tshirtbooth's video is a good guide.
Sign In or Register to comment.