Prev: B593 Up: Map Next: B5F7
B5C4: Send Sparkle At Player
Used by the routine at HandleEndingSparkles.
Handles a sparkle that has risen to the top. If the sparkle is close to the player the game ends, otherwise the sparkle is made deadly and set off towards the player.
Input
IX Address of the sparkle object
End the game if the sparkle is close to the player.
SendSparkleAtPlayer B5C4 LD A,($5C09) Fetch the X coordinate of the player.
B5C7 SUB (IX+$01) Subtract the X coordinate of the sparkle.
B5CA JP P,SendSparkleAtPlayer_TestX Jump to SendSparkleAtPlayer_TestX if the result is positive.
B5CD NEG Make it positive.
SendSparkleAtPlayer_TestX B5CF CP $06 Jump to SendSparkleAtPlayer_Fly if the sparkle is 06 or more away from the player in X.
B5D1 JR NC,SendSparkleAtPlayer_Fly
B5D3 LD A,($5C0A) Fetch the Y coordinate of the player.
B5D6 SUB (IX+$02) Subtract the Y coordinate of the sparkle.
B5D9 JP P,SendSparkleAtPlayer_TestY Jump to SendSparkleAtPlayer_TestY if the result is positive.
B5DC NEG Make it positive.
SendSparkleAtPlayer_TestY B5DE CP $06 Jump to GameOver if the sparkle is less than 06 away from the player in Y too, as the sparkle has caught the player.
B5E0 JP C,GameOver
Make the sparkle deadly and send it towards the player.
SendSparkleAtPlayer_Fly B5E3 SET 7,(IX+$0D) Flag the sparkle as fatal if it hits the player.
B5E7 SET 1,(IX+$07) Flag the sparkle as ignored in the 3D calculations.
B5EB LD (IX+$0B),$01 Make the sparkle drop at a speed of 01.
B5EF LD BC,$0404 Set the speed towards the player to 04 in X and in Y.
B5F2 CALL SetSpeedTowardsPlayer Move the sparkle towards the player.
B5F5 JR SetSparkleSpeed_Move Jump to SetSparkleSpeed_Move.
Prev: B593 Up: Map Next: B5F7