# Checking score for extra lives

## Recommended Posts

Posted (edited)

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

##### 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```

##### Share on other sites

Ah yes can't multiply - did read that thinking back now 😳 😳 😳 I'll try that out shortly thank you 👍

##### Share on other sites

That fixed it - thanks Mike 👍

##### Share on other sites

You're welcome. One step closer... 😛

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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