Add SetupDistanceFromSprite macro

This commit is contained in:
scawful
2024-10-06 09:40:40 -04:00
parent 1e27733a3b
commit 690a9e4003
2 changed files with 11 additions and 6 deletions

View File

@@ -135,10 +135,7 @@ Sprite_DekuScrubEnemy_Main:
INC.w SprAction, X INC.w SprAction, X
.not_done .not_done
LDA.w POSX : STA $02 %SetupDistanceFromSprite()
LDA.w POSY : STA $03
LDA.w SprX, X : STA $04
LDA.w SprY, X : STA $05
JSL GetDistance8bit_Long : CMP #$18 : BCS .not_too_close JSL GetDistance8bit_Long : CMP #$18 : BCS .not_too_close
%GotoAction(0) %GotoAction(0)
.not_too_close .not_too_close

View File

@@ -210,9 +210,17 @@ macro SetTimerF(length)
endmacro endmacro
macro NextAction() macro NextAction()
INC $0D80, X INC $0D80, X
endmacro endmacro
macro GetTilePos(x, y) macro GetTilePos(x, y)
LDX.w #((<y>*$80)+(<x>*$02)) LDX.w #((<y>*$80)+(<x>*$02))
endmacro endmacro
macro SetupDistanceFromSprite()
LDA.w POSX : STA $02
LDA.w POSY : STA $03
LDA.w SprX, X : STA $04
LDA.w SprY, X : STA $05
endmacro