Jump to content
IGNORED

Checking score for extra lives


mksmith

Recommended Posts

Currently i'm trying to add additional lives once you reach a stated number (in this case first 20,000 then every 60,000 points). I'm trying to do the following:

 

 sc0=score0
 sc1=score0+1
 sc2=score0+2
 scoreLifeBenchmark = 0

validateExtraLife
 rem check 20,000
 if sc0 >= $02 && scoreLifeBenchmark = 0 then playerLives = playerLives + 1 : scoreLifeBenchmark = scoreLifeBenchmark + 1 : goto _exitValidateExtaLife
 rem check every 60,000
 value = 6*scoreLifeBenchmark
 if sc0 >= value then playerLives = playerLives + 1 : scoreLifeBenchmark = scoreLifeBenchmark + 1 : goto _exitValidateExtaLife
_exitValidateExtaLife
 return thisbank

 

So essentially what happens as you reach a benchmark it increases that value by one thus you can then check 6*1=6 (60,000), 6*2=12 (120,000), 6*3=18 (180,000) etc against the first 2 digits in the score.

 

Can anyone shed some light - the score stuff does my head in regularly!

 

 

 

Edited by mksmith
Link to comment
Share on other sites

You're close. The thing is, the score is stored in BCD format, and stuff like "value = 6*scoreLifeBenchmark" isn't BCD compatible - the 6502 can only add and subtract in BCD format.

 

I haven't tested it out, but something like the following should work...

 

sc0=score0
 sc1=score0+1
 sc2=score0+2
 scoreLifeBenchmark = 0

validateExtraLife
 rem check 20,000
 if sc0 >= $02 && scoreLifeBenchmark = 0 then playerLives = playerLives + 1 : dec scoreLifeBenchmark = scoreLifeBenchmark + 6 : goto _exitValidateExtaLife
 rem check every 60,000
  if sc0 >= scoreLifeBenchmark then playerLives = playerLives + 1 : dec scoreLifeBenchmark = scoreLifeBenchmark + 6 : goto _exitValidateExtaLife
_exitValidateExtaLife
 return thisbank

 

  • Like 1
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.

Guest
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.

Loading...
  • Recently Browsing   0 members

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