add chance of respawning head if the other isnt killed soon after

This commit is contained in:
scawful
2024-06-10 13:25:57 -04:00
parent fd01d53da7
commit 61aa373ba8

View File

@@ -41,6 +41,7 @@ Sprite_Kydreeok_Long:
JSL Sprite_CheckActive : BCC .SpriteIsNotActive JSL Sprite_CheckActive : BCC .SpriteIsNotActive
JSR Sprite_Kydreeok_Main JSR Sprite_Kydreeok_Main
JSR Sprite_Kydreeok_CheckIfDead JSR Sprite_Kydreeok_CheckIfDead
JSR MaybeRespawnHead
.SpriteIsNotActive .SpriteIsNotActive
LDA.w SprState, X : BNE .not_inactive LDA.w SprState, X : BNE .not_inactive
@@ -89,10 +90,12 @@ Sprite_Kydreeok_CheckIfDead:
LDA.w SprState, Y : BEQ .offspring1_dead LDA.w SprState, Y : BEQ .offspring1_dead
JMP .not_dead JMP .not_dead
.offspring1_dead .offspring1_dead
LDA Offspring2_Id : TAY LDA Offspring2_Id : TAY
LDA.w SprState, Y : BEQ .offspring2_dead LDA.w SprState, Y : BEQ .offspring2_dead
JMP .not_dead JMP .not_dead
.offspring2_dead .offspring2_dead
LDA.w SprMiscD, X : CMP.b #$02 : BEQ .dead LDA.w SprMiscD, X : CMP.b #$02 : BEQ .dead
LDA.b #$02 : STA.w SprMiscD, X LDA.b #$02 : STA.w SprMiscD, X
LDY.b #$01 : JSR ApplyKydreeokGraphics LDY.b #$01 : JSR ApplyKydreeokGraphics
@@ -107,6 +110,23 @@ Sprite_Kydreeok_CheckIfDead:
RTS RTS
} }
; Head may respawn if the other isn't killed in time
MaybeRespawnHead:
{
LDA.w Offspring1_Id : TAY
LDA.w SprState, Y : BNE .offspring1_alive
JSL GetRandomInt : AND.b #$7F : BNE .offspring1_alive
JSR SpawnLeftHead
.offspring1_alive
LDA.w Offspring2_Id : TAY
LDA.w SprState, Y : BNE .offspring2_alive
JSL GetRandomInt : AND.b #$7F : BNE .offspring2_alive
JSR SpawnRightHead
.offspring2_alive
RTS
}
; ========================================================= ; =========================================================
Sprite_Kydreeok_Main: Sprite_Kydreeok_Main:
@@ -131,10 +151,10 @@ Sprite_Kydreeok_Main:
LDA SprMiscD, X : BNE .go LDA SprMiscD, X : BNE .go
LDY #$00 LDY #$00
JSR ApplyKydreeokGraphics JSR ApplyKydreeokGraphics
JSR ApplyPalette
LDA.b #$01 : STA SprMiscD, X LDA.b #$01 : STA SprMiscD, X
.go .go
JSR ApplyPalette
JSL Sprite_PlayerCantPassThrough JSL Sprite_PlayerCantPassThrough
LDA SprTimerA, X : BNE .continue LDA SprTimerA, X : BNE .continue
@@ -171,7 +191,6 @@ Sprite_Kydreeok_Main:
%StartOnFrame(0) %StartOnFrame(0)
%PlayAnimation(0, 2, 10) %PlayAnimation(0, 2, 10)
LDA $36 LDA $36
JSL Sprite_ApplySpeedTowardsPlayer JSL Sprite_ApplySpeedTowardsPlayer
JSR StopIfOutOfBounds JSR StopIfOutOfBounds