Save and load high score?!
I have a problem with a game I'm making. It's an endless runner with a timer in one corner, I have "coded" it this way": "Display text-->game.score" (I have integers for score and high score). Further I have put in a timer function, adding 1 to score for each sec (change attribute-->"game.score+1"). When the game ends the scene shifts to a "game over screen" displaying the score. In the score bar I have put in: "display text-->game.score", then a rule: when attribute game.score is higher than game.highscore, change attribute game.highscore to game.score", and save attribute "game.highscore", key: "game.highscore". On the first screen I want to display the highscore, I have put in "display text: game.highscore" and "load attribute: "game.highscore", key: "game highscore". I saw this on youtube, but I can't get it to work. The highscore bar in the initial screen just says "0". I want it to load the highest score, and to update when a new high score is achieved. Any ideas?
Comments
Personally I've always found tables to be a lot less complicated than attributes.
Only thing I can think of is making sure you've got the behaviours displayed in the right order, or if there's a spelling / syntax error somewhere. Hard to see without a screengrab of rules.
Finally, please don't post the exact same post three times. You say you don't want to spam but that's exactly what you're doing.
@Are Skarstein Kolberg most likely you are setting your text behaviour before you have loaded you highscore attribute.
Yeah I'd use tables.
You just say "save table" at your gameover screen and it automatically loads when you bootup
There is literally no benefit to using a table to save 1 or 2 pieces of information. It's more overhead. People need to stop being so afraid of attributes!
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
I agree, but I've never created a game where I only saved 1 or 2 attributes. Highscore, level progress, achievements, play stats etc. In fact, for me, there is rarely less than a dozen and it's easier for me to have everything in a table.