Save/Load Attribute issues

Im trying to keep track of what levels have been beaten what what levels are locked. After testing a published version

-- I'm still not sure if anything is actually getting saved... I play the game and beat the first 20 levels. So 21 levels are now unlocked and playable. I click the home button and re-enter the game and the 21 levels are still unlocked. BUT when I close the app (double click the home button and delete the app from memory) AND then re-open/load the game all of the levels are locked again. SO it seems it never saved the data.

After I beat the hero beats the level...
I'm doing the following:

change attribute: game.unlock To: game.unlock+1

save attribute
Attribute: game.unlock Key:unlock

When the game starts/main Menu
I'm doing the following:

Load Attribute
Key: unlock Attribute: game.unlock

Please help, last thing I have to do before publishing! Thanks

Best Answer

  • gyroscopegyroscope I am here.Posts: 6,598
    edited December 2012 Accepted Answer

    OK, I see what you're after now; so with your unlocked levels, you'll need one boolean attribute for each of your levels to indicate whether locked or unlocked, as far as I can see.

    So on the lines of

    When All Conditions are valid:
    Actor receives: event overlaps or collides: with actor of type: hero
    Change Attribute game.whatLevel01 to true

    Save Attribute:
    Attribute game.whatLevel01 key:L1

    ----and similar for all other levels--

    And then on the main menu of game, an actor off to the side of the screen
    that loads the attribute.

    Load Attribute
    Key: L1 attribute:game.whatLevel01

    Load Attribute
    Key: L2 attribute:game.whatLevel02

    ---etc.

    In your level choices on the Menu card (presuming this is what you've got):
    --in the first level
    When game.whatLevel01 is true
    Change Image to Unlocked

    When touch is pressed and game.whatLevel01 is true
    Change Scene to Scene1

    ----etc

    That's roughly it; hope it work out for you.

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

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Your rules look correct. I'd recommend submitting a bug report.

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

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @TpapaSLICE Hi, couple of things, it's usual to have two buttons on your main Menu, one which is New Game, and another called Continue, or Continue game, whatever you want. This way, you can guarantee your fresh game from the start will happen by clicking New Game, with the only Rule there being Change Scene to your first Scene.

    Next, providing all your Load Attribute Behaviours are in the continue Button, including which scene to continue from, and providing they've all been saved previously, then there should be no reason for it not to fail....

    Second to say, I'm not sure how you're saving each unlocked level with one attribute; there is a way to do that with extra rules though; but you haven't indicated that's what you're doing, so there could be a prob. there that needs sorting.

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

  • LiosStudiosLiosStudios Member Posts: 53
    I thought about and a "New Game" button that doesn't really fit my game. It is kind of set up like angry birds. You click play and takes you to all of the levels you have finished, the level you have not yet beat is unlocked, but the level past that level is locked.

    When the hero beats the level (in the case of my game he collides with a treasure chest) I have a rule in the treasure chest:

    When All Conditions are valid:
    Actor receives: event overlaps or collides: with actor of type: hero
    Attribute:self.what level am i = game.unlock

    Change Attribute:
    Game.unlock to game.unlock+1

    Save Attribute:
    Attribute game.unlock key:unlock

    And then on the main menu of my game I have an actor off to the side of the screen
    that loads the attribute.

    Load Attribute
    Key: unlock attribute:game.unlock



Sign In or Register to comment.