HOW DO YOU SAVE??

I'm currently working on a quiz game that asks you different questions on each scene. I managed to save the score so that every time you re-open the game, you start with the same amount of points you ended with the last time you played. I'm currently trying to find a way to save the question where you left of so that next time you open the game, you don't have to restart all of the questions to get to where you were before. Does anyone know how I could make this work?

Comments

  • lescobar94lescobar94 Member Posts: 25
    In short: how do you save/load the last scene you were in?
  • lycettebroslycettebros Member, PRO Posts: 1,598
    @lescobar94 You could probably create an attribute for the scene you are currently in (say a number) and then when the hibernate button is pressed (although this is technically only for Android) you save that attribute. On opening the app it loads the attribute and a rule tells it to go to that saved attribute, which is the last scene.

    On iOS I do not think you can work out when a person closes the App to save the attribute. Perhaps you could change and save the scene attribute each time you enter a new scene so it knows the last scene you are in. Again loading the saved attribute and telling the app to go to that scene.

    Hope that makes some sense.
  • lescobar94lescobar94 Member Posts: 25
    Thanks! what rule can I use to tell the game to go to the saved attribute?
  • lycettebroslycettebros Member, PRO Posts: 1,598
    edited July 2013
    @lescobar94 There is a "load attribute" rule in the behaviours list.
    Once you have "saved attribute" have a "load attribute" command in the beginning of your game (first scene perhaps) then tell the game to go the scene that correlates with the saved attribute.
  • lycettebroslycettebros Member, PRO Posts: 1,598
    edited July 2013
    You could also save it to a table....but for the above method the rule might be like this:

    if attribute equals 1 go to scene 1
    if attribute equals 2 go to scene 2

    You could also make it only checks to see if the attribute is above zero so that you know a scene has been visited otherwise it would ignore the rule and continue as normal:

    If attribute is => 2 then
    if attribute equals 2 go to scene 2
    if attribute equals 3 go to scene 3
    otherwise
    go to scene 1
  • lescobar94lescobar94 Member Posts: 25
    If I have 50 or 300 questions, would that mean I have to add the same amount of rules?
  • lycettebroslycettebros Member, PRO Posts: 1,598
    These rules are for a single item like what scene you were in.
    if you are wanting to store that many values then you should use tables. Tables can store the answer values and also what scene a player is up to. It will be more efficient and easier for you.
    I suggest you look up some tutorials on working with tables in the Cookbook or people's videos -they will tell you all you need to know to get started with a solution.
  • lescobar94lescobar94 Member Posts: 25
    I've been researching about tables and I think I know what you mean. The only thing I'm stuck in is in trying to find a specific rule that changes to the scene with the attribute or the table value.
  • lycettebroslycettebros Member, PRO Posts: 1,598
    There is no specific rule as it were, you have to make one.

    Change an attribute based on whichever scene you are in and make sure that attribute it written to a table cell value and saved. This is then the value you recall and test to see what scene you should be in/at.
  • lescobar94lescobar94 Member Posts: 25
    Ok, I have attributes being saved and changed on each different scene and linked to a table. The game can also recognize what scene corresponds to what attribute value using that table. How would I go about telling the game to change the current scene to the scene that it recognizes as linked with the current attribute value?
Sign In or Register to comment.