Closing App, save levels! Need Help

Hello,
Dunno if this discussion is placed in the right topic. As the title says i need help with saving levels after closing app.
I have my app running on my iPhone device (used Ad Hoc & xCode). My game is using a level system, so when u win lvl 1 you unlock lvl 2 etc.
This works fine as long as i don´t close the app thought double tapping the home bottom and the shut the app down.
After i have shut the app down and open the game I have to start at lvl 1 again.

How can i avoid this problem?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You're in the right place.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • OdenSoftwareOdenSoftware Member Posts: 34
    Yeaa i have done this but when i have now putted it on my device it saves as long as i don't shut the app down totally.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If you load the attribute when the game starts and save it whenever needed, it will work on the device.

    Are you using GS Viewer or an adhoc install of the app?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • OdenSoftwareOdenSoftware Member Posts: 34
    Okey, well im using the Ad Hoc for testing my game. Why?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Can you post a screenshot of your rules, especially the load attribute and save attribute behaviors, or post a link to download your project file if you prefer?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • OdenSoftwareOdenSoftware Member Posts: 34
    Okey now i thought i haved fixed this. But now all levels are unlocked when i start the game.

    This are my attribute for the level savings after i have unlocked next level.

    Attribute [game.Win is true]
    Attribute [game.Level = 1]
    Attribute [game.World = 1]
    Actor receives event [overlaps or colide with actor of type Goal]
    Change attribute [game.level1world1Cleard to true]
    Save attribute [game.level1world1Cleard key: save]

    Then i have an actor on the starting screen saying

    Load attribute[Key: save attribute:game.level1world1Cleard]
    Load attribute[Key: save attribute:game.level2world1Cleard]
    Load attribute[Key: save attribute:game.level3world1Cleard]
    Load attribute[Key: save attribute:game.level4world1Cleard]
    etc.


    What am I doing wrong this time? Please help :)
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You're using the same key name for all of your attributes. Keys can only save one value at a time. You'd need a unique key name for each attribute. I usually use the exact attribute name like this:

    Save attribute [game.level1world1Cleard key: level1world1Cleard]

    If you do it that way, just make sure to double- or triple-check all of your spellings.

    It's generally easier to use a table if you have many attributes to save. Just store your attributes in a table with each column representing a level. The nice thing about tables is that they auto-load at the start of the game and you can save all of those attributes with a single Save Table [table name] behavior.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • OdenSoftwareOdenSoftware Member Posts: 34
    Thanks for ur help i solve it now thnaks to u !
Sign In or Register to comment.