I've attached the entire code below but the relevant section is this:
;------------------------------- ; Friction (broken ) ;------------------------------- ApplyFriction .xfriction lda xspeed+1 bmi .doNegFrict lda xspeed bmi .doNegFrict .checkPosFrict lda xspeed+1 ;check if 0 beq .checkLow jmp .doPosFrict .checkLow lda xspeed beq .yfriction .doPosFrict;positive speed, subtract friction from speed sec lda xspeed sbc #FrictionLow sta xspeed lda xspeed+1 sbc #0 sta xspeed+1 jmp .yfriction ;negative speed, add friction to speed .doNegFrict clc lda xspeed adc #FrictionLow sta xspeed lda xspeed+1 adc #0 sta xspeed+1 .yfriction ;Not done yet
It would seem it works as I expect when the xspeed is negative (sprite moving left) but when positive xspeed+1 > 0 friction no longer applies.
2 thoughts
1) this is probably a simple bug, but I cant seem to see it.
2) there is probably a much easier way of applying friction to a given speed than the method I am using above
Any suggestions?















