diff --git a/Sprites/ZSpriteLib/sprite_new_functions.asm b/Sprites/ZSpriteLib/sprite_new_functions.asm index 5a3b591..6b563ab 100644 --- a/Sprites/ZSpriteLib/sprite_new_functions.asm +++ b/Sprites/ZSpriteLib/sprite_new_functions.asm @@ -813,4 +813,24 @@ Sprite_ApplySpeedTowardsPlayerXOrY_Long: LDA.b #$00 : CLC : ADC $00 : STA.w SprXSpeed STZ.w SprYSpeed RTL +} + + +GetDistance8bit_Long: +{ + LDA $04 ; Sprite X + SEC : SBC $02 ; - Player X + BPL + + EOR.b #$FF : INC + + + STA $00 ; Distance X (ABS) + + LDA $05 ; Sprite Y + SEC : SBC $03 ; - Player Y + BPL + + EOR.b #$FF : INC + + + ; Add it back to X Distance + CLC : ADC $00 : STA $00 ; distance total X, Y (ABS) + RTL } \ No newline at end of file