Custom Score

ZeGGamer1

New member
Hello all, if you were wondering how to change the amount of points you get when you kill an enemy, collect a coin, or more, this is for you. (Note, I have yet to test this in all modules but this is more of a coding tutorial than a comprehensive guide.)

Step 1: Find the Score Location.
The most common place you would need for changing how many point you get for any given action would be in the Handle script for enemy collision and damage, or for coins, you would go to the Collectible just for score script. then you will want to find the point where it adds value to the score for instance, it should look something like this

AddValue #$08, myScore, #$01, #$00


Step 2: Break it down.
The two most important parts are the pair of Hexadecimal numbers after myScore. you can look at them like this.

AddValue #$08, myScore, # of points, position the points go to.


Step 3: how to use the Information.
In the following examples I will show what value will be added to the myScore value.

AddValue #$08, myScore, #$01, #$00
Gives the player one point in the ones place, so you would get 1 point

AddValue #$08, myScore, #$01, #$02
Gives the player one point in the hundreds place, so you would get 100 points

AddValue #$08, myScore, #$05, #$00
Gives the player five points in the ones place, so you would get 5 points

AddValue #$08, myScore, #$05, #$01
Gives the player five points in the tens place, so you would get 50 points

Note: you should generally stick with numbers 0-9 when adding points in Hexadecimal, because even though it will still work if you have something like this, (AddValue #$08, myScore, #$0a, #$03) it is a little difficult for anyone not an ASM pro to read it.

Hope this helps someone.
 

FrankenGraphics

New member
ZeGGamer1 said:
Note: you should generally stick with numbers 0-9 when adding points in Hexadecimal, because even though it will still work if you have something like this, (AddValue #$08, myScore, #$0a, #$03) it is a little difficult for anyone not an ASM pro to read it.

That readability issue is easy to solve. You can enter values in decimals. To enter our value (#$0a or just #$a, whichever is fine), remove the dollar sign to let the assembler know it's going to translate a decimal value to hexadecimal at build time and type down the actual decimal-coded value you prefer, like so:

AddValue #$08, myScore, #10, #3

Basically reads add 10 000

i haven't used this routine yet but i'm expecting it will carry the 1 to the next decimal.


Curiosa:
The thing with the NES variant of the 6502 processor is that hardware-accelerated decimal counting was removed to obfuscate that they did in fact steal the processor design from mos technology without paying license (and by butchering the design in the margins they could argue it was a different design, just one that is suspiciously similar). So that is why decimals have to be calculated in software instead. You wouldn't need to calculate scores etc in a such a convoluted way on the commodore 64 or apple II. ;)
 
Top Bottom