From 39dbe806a806e187eabba217fe2779c14f6334ca Mon Sep 17 00:00:00 2001 From: scawful Date: Sun, 15 Dec 2024 17:57:04 -0500 Subject: [PATCH] Add Sprite_CheckCollisionWithSprite --- Core/sprite_functions.asm | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Core/sprite_functions.asm b/Core/sprite_functions.asm index 2f2e635..2e996d2 100644 --- a/Core/sprite_functions.asm +++ b/Core/sprite_functions.asm @@ -318,6 +318,22 @@ Sprite_Damage_Flash: RTS } +; A = Spr ID to check +Sprite_CheckCollisionWithSprite: +{ + STA.b $00 + JSL Sprite_CheckForPresence : BCC + + PHX + LDA.b $02 : TAX + JSL Sprite_SetupHitBox + PLX + JSL Sprite_SetupHitBox_Alt + JSL CheckIfHitBoxesOverlap : BCC + + LDA.b #$01 : STA.w SprMiscF, X + + + RTL +} + ; $00 - ID of the sprite to check ; $01 - Current sprite index ; $02 - Index of the sprite found @@ -339,6 +355,7 @@ Sprite_CheckForPresence: .continue CPX.b #$00 : BNE .x_loop + CLC .done PLX RTL