Prev: 46483 Up: Map Next: 46583
46532: 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 46532 LD A,(23561) Fetch the X coordinate of the player.
46535 SUB (IX+1) Subtract the X coordinate of the sparkle.
46538 JP P,SendSparkleAtPlayer_TestX Jump to SendSparkleAtPlayer_TestX if the result is positive.
46541 NEG Make it positive.
SendSparkleAtPlayer_TestX 46543 CP 6 Jump to SendSparkleAtPlayer_Fly if the sparkle is 6 or more away from the player in X.
46545 JR NC,SendSparkleAtPlayer_Fly
46547 LD A,(23562) Fetch the Y coordinate of the player.
46550 SUB (IX+2) Subtract the Y coordinate of the sparkle.
46553 JP P,SendSparkleAtPlayer_TestY Jump to SendSparkleAtPlayer_TestY if the result is positive.
46556 NEG Make it positive.
SendSparkleAtPlayer_TestY 46558 CP 6 Jump to GameOver if the sparkle is less than 6 away from the player in Y too, as the sparkle has caught the player.
46560 JP C,GameOver
Make the sparkle deadly and send it towards the player.
SendSparkleAtPlayer_Fly 46563 SET 7,(IX+13) Flag the sparkle as fatal if it hits the player.
46567 SET 1,(IX+7) Flag the sparkle as ignored in the 3D calculations.
46571 LD (IX+11),1 Make the sparkle drop at a speed of 1.
46575 LD BC,1028 Set the speed towards the player to 4 in X and in Y.
46578 CALL SetSpeedTowardsPlayer Move the sparkle towards the player.
46581 JR SetSparkleSpeed_Move Jump to SetSparkleSpeed_Move.
Prev: 46483 Up: Map Next: 46583