Hello all,
I'm writing some code for a combo system for my hack, and both wanted some help on learning how to access this code via killing an enemy, and also any feedback if there's something wrong or if something can be improved upon with this code:
Any and all help is much appreciated!
I'm writing some code for a combo system for my hack, and both wanted some help on learning how to access this code via killing an enemy, and also any feedback if there's something wrong or if something can be improved upon with this code:
Code
; $7C will be the RAM address for the combo timer. When at 0, the combo bonus is calculated and added to score, then the combo amount returns to 0. .AddToComboCounter: LDA #$6F STA $7C|!addr ; Set timer to #$6F every time an enemy is stomped. LDA $1697|!addr ; Address subject to change. INC A STA $1697|!addr ; Increase combo count by 1. (might be unnecessary because this number already increases when stomping enemies.) BRA .ComboLoop .ComboLoop: LDA $72|!addr ; Mario's State, $00 = Grounded CMP #$00 BNE .ComboLoop ; Loop if not grounded. LDA $14|!addr ; Every 4th frame... AND #$03 BNE .ComboLoop ; Loop if not 4th frame. LDA $7C|!addr ; Combo Timer (Will be set to #$6F when enemy stomped) CMP #$00 BEQ .EndCombo ; Jump to combo-end routine when timer hits #$00. DEC $7C|!addr BRA .ComboLoop ; Otherwise, decrement timer and loop once more. .EndCombo: ; Squares the combo count and adds to the score using the multiplication register. LDA $1697|!addr STA $4202 LDA $1697|!addr STA $4203 NOP #4 REP #$20 LDA $1487|!addr ; 16-bit RAM for the score tally patch. ADC $4216|!addr ; Product of squaring the combo count. STA $1487|!addr SEP #$20 STZ $1697 ; Clear combo count. RTL
Any and all help is much appreciated!