[4.5.9] 10, 000 points = 1 Life ~ Simple Score Tutorial

smilehero65

Active member
Score didn't always used to be a filler number on the screen.

1715120310892.png

Arcade games like Pac-Man used to grant an extra live after reaching 10,000 points.
We can easily achieve that on NESMaker!​
FOR TILE/STANDARD HUD USERS only
* Before starting, you may need to implement Dale Coop's fix on updating multiple elements on the HUD.



1) Let's make a variable called myBenchmark, and assign a value of 1.

1715119268563.png

2) Then, add this piece of code:
  • every instance you get points,
OR​
  • once in your Handle Game Timer script (this is more efficient and optimal)

Code:
LDA myScore_10000        ;;;;Load the 10,000 place
CMP myBenchmark            ;;;;Check if the 10,000 place = benchmark
BNE +giveExtraLive        ;;;;If so...

        ;;We Will Increase the Benchmark with INC
        ;;INC adds variables just by *ones*
        
    INC myBenchmark        ;;;;Increase the benchmark
    INC myLives            ;;;;Add an extra Live, by ones
    

    ;;;Update HUD Element -- only if you use a tile HUD
    ;;;If you have a Sprite HUD, you can skip this
    UpdateHudElement myLives, #$02 ;<------ or whatever number your lives variable is in the HUD



+giveExtraLive


When the number in myScore_10000 is equal to 1 (the Benchmark), then the score is 10,000 or a bit more.
The variable Benchmark is increased by 1, so the next check will be done when the score is 20, 000.

In that way, when your score increases in intervals of 10,000, you will be granted with an extra live!


~ EXTRA ~
BUT, what if 10,000 makes your game too easy?
Let's try to raise the bar! (or the benchmark)


1) Increase the initial variable of myBenchmark

Points to Get Extra Live
myBenchmark
20,0002
30,0003
40,0004

. . . you get the idea


For this example, we will do 30,000.
Just like the Castlevania games.



2) Now we will tweak the code to increase your life once the score reached the benchmark:


Code:
LDA myScore_10000        ;;;;Load the 10,000 place
CMP myBenchmark            ;;;;Check if the 10,000 place = benchmark
BNE +giveExtraLive        ;;;;If so...

        ;;Instead of Increasing myBenchmark by ones,
        ;;we will increase them by threes,
        ;;or any number you want
        
    LDA myBenchmark        ;;;; Load the Benchmark
    ADC #3                   ;;;; Add 3
    STA myBenchmark           ;;;; Store the value on the Benchmark

    INC myLives            ;;;;Add an extra Live, by ones
    

    ;;;Update HUD Element -- only if you use a tile HUD
    ;;;If you have a Sprite HUD, you can skip this
    UpdateHudElement myLives, #$02 ;<------ or whatever number your lives variable is in the HUD



+giveExtraLive


(requested by Scott Savage on Facebook, kudos to him!)


That's it!
Now your Score will be a bit less useless! šŸ˜‚
 
Last edited:
Top Bottom