how to save high score and load later

cherrywtzcherrywtz Member, PRO Posts: 40

how to save high score?
and load it when you start the game later.
help me out guys.

Comments

  • Bowhill GamesBowhill Games Member Posts: 191

    create a game level Attribute and set that to your score these are saved so if the game is closed and re-launched the score will be kept

    (site currently under construction)
  • CodeMonsterCodeMonster ACT, AustraliaMember Posts: 1,078

    got a nice top 10 highscore template here

  • cherrywtzcherrywtz Member, PRO Posts: 40
    edited July 2015

    @CodeMonster said:
    got a nice top 10 highscore template here

    thanks

  • cherrywtzcherrywtz Member, PRO Posts: 40

    @Bowhill Games said:
    create a game level Attribute and set that to your score these are saved so if the game is closed and re-launched the score will be kept

    can you say precisely ?

  • Bowhill GamesBowhill Games Member Posts: 191

    sorry i dont have GS on this machine so ill give a rough answer that will hopefully cover anything you need:

    To Save Score on exit
    create a game attribute called high_score, Game attributes are saved on exit of scene and game so will always show what you last set it to (you will only see that on device as the viewer acts like a first time run)

    To Show Score
    create a actor with the display text behaviour to show the score (display text-> game attribute -> high_score)

    To change Score
    when you want to increment the score (player gets points) use the change attribute behaviour based on a rule to determine if points are granted then (change attribute -> game attribute -> high_score To game attribute -> high_score +10)

    (site currently under construction)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @Bowhill Games said:
    create a game level Attribute and set that to your score these are saved so if the game is closed and re-launched the score will be kept

    This is wrong. This is the second post today I've seen you give the wrong information.

    You can save attribute data in two ways, one is via the save behaviors and also using a table. Most of us use tables. But if you only want to save the one top highscore you can use the save behavior. I'm going to do a video today on saving data methods as this topic has comeup a few times recently.

  • Bowhill GamesBowhill Games Member Posts: 191

    @The_Gamesalad_Guru tables are the best if you want to use a high score board (multiple entry's) but that wasn't the question, if you just want one score then i find a game attribute is a quicker approach.

    (site currently under construction)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @Bowhill Games said:
    The_Gamesalad_Guru tables are the best if you want to use a high score board (multiple entry's) but that wasn't the question, if you just want one score then i find a game attribute is a quicker approach.

    They wanted to know how to save a score. What you said about game attributes being saved in your first post was wrong. Attributes are not saved unless you use the save and load behavior. If a new comer were to read this they would assume that all data in game attributes save automatically. I understand you are trying to help and i would advice to be more clear in your answers to posts.

  • Bowhill GamesBowhill Games Member Posts: 191
    edited July 2015

    @The_Gamesalad_Guru I have a quite frankly rubbish game called cyber wars in which I use that exact method not using the save or load behaviour (didn't know they existed at the time), I am just setting a 'Game Attribute' called Score and having an actor display. iv just tested it again to be sure and it does Save the value it has been set to.

    I hadn't tested the game in months and high score = 500, I beat the score (550) forced shutdown of app from settings/ applications just to be sure it want always open, opened it again and high score = 550 so this would suggest that game attributes are saved.

    (site currently under construction)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @Bowhill Games said:
    The_Gamesalad_Guru I have a quite frankly rubbish game called cyber wars in which I use that exact method not using the save or load behaviour (didn't know they existed at the time), I am just setting a 'Game Attribute' called Score and having an actor display. iv just tested it again to be sure and it does Save the value it has been set to.

    I hadn't tested the game in months and high score = 500, I beat the score (550) forced shutdown of app from settings/ applications just to be sure it want always open, opened it again and high score = 550 so this would suggest that game attributes are saved.

    That shouldn't be as then every default value in a game once modified would change. this would screw up an entire game. Post and example of this phenomenon if you would. I am always ready to be proven wrong.

  • Bowhill GamesBowhill Games Member Posts: 191

    @The_Gamesalad_Guru that's what I thought why I set certain values at the start of each game, mabie it was a bug in the version I was using, I will post an example when I Finnish work

    (site currently under construction)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    I just made a quick video example. you are misinformed or something is wrong with your code.

  • Bowhill GamesBowhill Games Member Posts: 191

    @The_Gamesalad_Guru that's great got no problem if I'm wrong but you do need to publish to device as I say above I'll create a project when the work day is over and upload it with a video on device

    (site currently under construction)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    As I said if this was true then all variables would be screwed up. It must be an error as such a thing would screw up everything and all games being published would be screwed up horribly.

  • cherrywtzcherrywtz Member, PRO Posts: 40

    @The_Gamesalad_Guru said:
    As I said if this was true then all variables would be screwed up. It must be an error as such a thing would screw up everything and all games being published would be screwed up horribly.

    donotauto save means..does player has to do it..manually everytime??? :|

  • cherrywtzcherrywtz Member, PRO Posts: 40

    @Bowhill Games said:
    The_Gamesalad_Guru that's great got no problem if I'm wrong but you do need to publish to device as I say above I'll create a project when the work day is over and upload it with a video on device

    do your best dude...good luck :)

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @cherrywtz said:

    Your code will be setup to save when needed. I'm going to make a video with the basics today.

  • cherrywtzcherrywtz Member, PRO Posts: 40

    @The_Gamesalad_Guru said:
    Your code will be setup to save when needed. I'm going to make a video with the basics today.

    sure,let me know when it's done thanks a lot :)

  • Bowhill GamesBowhill Games Member Posts: 191

    I was 100% wrong I was using the save/ load attribute in that Cyber wars. apologies for the error.

    (site currently under construction)
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited July 2015

    @Bowhill Games said:
    I was 100% wrong I was using the save/ load attribute in that Cyber wars. apologies for the error.

    No problem we just try to make sure new users don't get confused. This is why it's important to understand the basics of what creator can and can't do. Those of us who do videos do lots of research and testing as users rely on us to be as accurate as humanly possible.

  • CraigMackCraigMack Member Posts: 27
    edited July 2015

    @The_Gamesalad_Guru I have copied your video and done a similar score system, but when i exit the preview of the game and go back on, the Highscore resets back to 0. Is this meant to happen in Gamesalad?

    I clicked the restart button and it saved the highscore, its just when I exit the preview and go back on.

  • tintrantintran Member Posts: 453
    edited July 2015

    @CraigMack said:
    The_Gamesalad_Guru I have copied your video and done a similar score system, but when i exit the preview of the game and go back on, the Highscore resets back to 0. Is this meant to happen in Gamesalad?

    I clicked the restart button and it saved the highscore, its just when I exit the preview and go back on.

    I had a similar problem where I loaded my highscore and it shows zero, but when i compared it to my score to see if score is higher than highscore then set highscore to score, the comparison didn't work.. I think maybe because the first time you load up the value is undefined or something.
    So i solved that by setting my highscore = max(highscore,score)
    this way even if highscore was undefined or something funky, max() function would return score.
    and it worked.
    Your problem might be unrelated to my problem, but just throwing it out there just in case you do have the same problem.

    EDIT: Oh, you're talking about the GS preview.
    the preview never works for me, it always resets to zero. But it works on my android.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Creator preview doesn't save anything, if it did it would change what you coded as default. You can only see a permanent save on a device.

Sign In or Register to comment.