SPRITE_CODE_START
JSR SUB_GFX ; graphics routine
LDA $9D ; \ if sprites locked, return
BNE RETURN ; /
JSR SUB_OFF_SCREEN_X3 ; handle off screen situation
LDA $13 ; \ if the animated frame is zero...
AND #$00 ; |
BNE CALC_FRAME ; /
LDA $C2,x ; \ if the sprite state is set
BEQ CALC_FRAME ; /
LDA $1570,x ; \ calculate which frame to show
BEQ CALC_FRAME ; /
DEC $1570,x ; decrease number of frames
CALC_FRAME
LDA $1570,x ; \ calculate which frame to show
BEQ UPDATE ; /
JSL $018022 ; update speed position without y speed
STA $1528,x ; prevent Mario from sliding horizontally
JSL $01B44F ; interact with sprites
BCC RETURN ; return if no contact
LDA $B6,x ;\ NEW CODE
BNE RETURN ;/ don't force x speed if already moving
X_SPEED
LDA EXTRA_PROP_1,x ; \ set direction depending on the extra property 1
STA $B6,x ; /
STA $C2,x ; store sprite state
RETURN
RTS ; return
UPDATE
JSL $01802A ; update position based on speed values
LDA $1491 ; amount to move Mario
STA $1528,x ; prevent Mario from sliding horizontally
JSL $01B44F ; interact with sprites
RTS ; return