Jump to content

Saving highscore problems


Recommended Posts

I am trying to save the highscore in my game and for some reason it refuses. I am not sure why this is happening, but I suspect that it has to do with the fact that I use score instead of _sc1, _Sc2, _sc3 or the temp variables.


When the game is over I send the code to a goto that compares the score to the HS (0 in the beginning) and save it if its higher.

   temp1 = score
   temp2 = score+1
   temp3 = score+2

   if temp1 > _a then goto __New_High_Score
   if temp1 < _a then goto __Skip_High_Score

   if temp2 > _b then goto __New_High_Score
   if temp2 < _b then goto __Skip_High_Score

   if temp3 > _c then goto __New_High_Score
   if temp3 < _c then goto __Skip_High_Score
   goto __Skip_High_Score


   _a = temp1 : _b = temp2 : _c = temp3


_a,_b,_c are all set to 0 at the beginning of the game and are not touched outside of this operation.


Then I try to flip back and forth between the current score and the old one by reusing a variable that doesn't get triggered during pause/Game over

 if !_startgame then goto __main
 ;reuse invisible var to flip HS back & forth
 _invisible0 = _invisible0 + 1
 if _invisible0 > 200 then _invisible0 = 0
   temp4 = score
   temp5 = score+1
   temp6 = score+2

 if _invisible0 < 100  then scorecolor = $44 
 if _invisible0 = 100  then _rand1=temp4 : _invisible1=temp5 : _speed=temp6 : temp4 = _a : temp5 = _b : temp6 = _c
 if _invisible0 > 100 && _invisible0 < 199  then scorecolor = $66
 if _invisible0 = 200 then temp4 = _rand1 : temp5 = _invisible1 : temp6 = _speed


It seems to work because the color of the score flips back and forth, but both scores are always the current number and all past HS's are gone.


Could anyone take a look at what is going wrong?




Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...