How to record a high score for later use?

Beckb

  • Posts: 72
I'd like to record the value of a number attribute (the high score) at a specific point in time so I can save it for later.

I'm creating a score counter where every collision increases the score to +1. I want to record the highest number of hits a player can reach within a given time, and save that value as their "high score" for future use.

Anybody got any tips? Many thanks in advance - you guys are always helpful.

choppedupmonkey

  • *
  • Posts: 602
create a new attribute named "highscore" and set score = to highscore

Beckb

  • Posts: 72
create a new attribute named "highscore" and set score = to highscore

I'm with you so far, but what do I do when the score changes? Won't the high score change with it since they're equal?

FYI - Using your example, I would like to save the "highscore" attribute as the value of the score at a specific point in time.

xplosion28

  • Posts: 275
If the score is less than the high score, don't change it.

choppedupmonkey

  • *
  • Posts: 602
exactly ^ i forgot to add that.

if score > highscore
   set highscore to score

NickamonPoppytail

  • Posts: 1141
Also, when you're saving the highscore, it's a good idea to make the game save itself, so if the game crashes or your computer runs out of battery, for example, the value of the highscore attribute isn't lost.
Upcoming Projects
Poppytail 5 and Pixeltail: Fifth and sixth main instalments in Poppytail series. A Game About Trimming Hedges: Final Version: An updated version of the original AGATH. One Million: Last-one-standing style small project. The Poppytales: Platformer boss rush with character collecting. Skies n' Fall: Boss rush shooter prequel to Rise n' Brawl. Precious: Weird platformer. Christmas Time 2: Sequel to Christmas Time 1.