how to save high score and load later
cherrywtz
Member, PRO Posts: 40
in Help Wanted
how to save high score?
and load it when you start the game later.
help me out guys.
Comments
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
got a nice top 10 highscore template here
GSINVENTION FREE TEMPLATES
thanks
can you say precisely ?
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)
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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@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
I just made a quick video example. you are misinformed or something is wrong with your code.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@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
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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
donotauto save means..does player has to do it..manually everytime???
do your best dude...good luck
Your code will be setup to save when needed. I'm going to make a video with the basics today.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
sure,let me know when it's done thanks a lot
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@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.
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.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS