How to save hiscore for each level separately?

famekraftsfamekrafts Member, BASIC Posts: 834
I just noticed my hiscore are getting saved and loaded at each stage but they are simply getting overwritten for the previous stage, how to make each stage or level hiscore to be stored separately? If anyone has a demo or video for hiscores saving loading please let me know.

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    How are you saving high scores? As attributes or in a table? If you use a table (or multiple tables) you shouldn't have a problem as long as you save the tables.

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

  • famekraftsfamekrafts Member, BASIC Posts: 834
    I was trying attribute, no idea how to save the tables.
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    I make an attribute for each and every level, and save and load each one. For an overall score, I save and load the score on every level, and I also add them together for the overall score at the current level.
    highscore1
    highscore2
    highscore3...etc

    And I do the same thing for regular scores.
    Score1
    Score2
    Score3...etc

    Lots of attributes to keep track of for saving and loading in each level, but it does work. Tables would probably be more efficient now.
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    @wickedsunny if you do what @SlickZero says but use tables for the data.

    you could have highscore alone but each scene or level make it update the table cell value for the respective level.

    Have the behaviour on the main actor. Change the attribute when you pass another actor(level) or change scene. That sort of thing. Tables will do it well.

    I will be doing a similar thing.

    Be warned that you will not see any data in your writeable tables. But it is there! You need to display them in the game to see them.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    That is fine but how to save and load data from tables after game is minimised or restarted in iPad? Save attribute works well in that regard, I just have no idea how to save a table value, maybe in the save attribute just select the table cell value? Is it that easy?
  • carlblanchetcarlblanchet Member Posts: 755
    edited November 2012
    Theres a behaviour called "Save Table". You would use this after changing the table cell value. (or whenever you wanna save the table :P)

    Tables are definitely worth looking into! Once you get how they work, they're loads if fun!
  • mataruamatarua Auckland, New ZealandMember Posts: 854
    Yep, I am adding things in a bag, only get added to the account once you get to a certain stage, then I write one attribute to the table, save the table just like @carlblanchet says that works a treat. Even in the testing process it remains with the coins/scores/hitpoints whatever when you restart. You just don't see it on the computer.

    The easiest way to test, which is what I did, create new actor, and in that actor, tell it to display the text of the table cell data you want. Place that in your hud and then you can see the table being updated on the fly.
  • carlblanchetcarlblanchet Member Posts: 755
    edited November 2012
    Made a tutorial :)


    (the project file is in the description too!)
  • carlblanchetcarlblanchet Member Posts: 755
    edited November 2012
    Obviously you could record the highscore when the level is over instead of during gameplay (which will eliminate the timer), but for the video's purpose, saving during gameplay made sense.
  • famekraftsfamekrafts Member, BASIC Posts: 834
    Thanks a lot man. For now I need it only after the level is over, but in future I might need during game play as well.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Saving to a table is easy just use the write to table bahavior and then to save what you wrote use the save table behavior.
Sign In or Register to comment.