Prev: 74B9 Up: Map Next: 7507
74D6: Check Hazard Collision
Checks if a hazard sprite has collided with Percy or Percy's egg. If the hazard hits Percy, the hit is recorded and a sound is played. If Percy has an active egg and the egg hits the hazard, the hazard is stunned, the egg is cancelled and points are awarded.
Input
IX Pointer to the hazard sprite data
IY Pointer to the hazard state data
Check_Hazard_Collision 74D6 PUSH IY Stash the hazard state pointer on the stack.
74D8 LD IY,$DAC0 Point IY at Percy_X_Position (Percy's sprite data).
74DC CALL CheckSpriteCollision Call CheckSpriteCollision to check if the hazard collides with Percy.
74DF POP IY Restore the hazard state pointer from the stack.
74E1 JR C,Check_Egg_Hit Jump to Check_Egg_Hit if there's been no collision with Percy.
This entry point is used by the routines at Handler_Balloon and Handler_Spider.
The hazard has hit Percy.
Hazard_Hit_Percy 74E3 LD ($5FA7),A Write the collision result to *FallingState.
74E6 CALL PlayHitSound Call PlayHitSound.
74E9 RET Return.
No collision with Percy; check if Percy's egg is active and whether it hits the hazard.
Check_Egg_Hit 74EA LD A,($5FA9) Return if *EggDropFlag is zero (no egg active).
74ED OR A
74EE RET Z
74EF PUSH IY Stash the hazard state pointer on the stack.
74F1 LD IY,$DAE0 Point IY at Egg_X_Position.
74F5 CALL CheckEggCollision Call CheckEggCollision.
74F8 POP IY Restore the hazard state pointer from the stack.
74FA RET C Return if there's been no collision with the egg.
The egg has hit the hazard; stun it and award points.
Egg_Stuns_Hazard 74FB LD (IY+$00),$80 Write 80 to *IY+00 to set bit 7 (mark the hazard as stunned).
This entry point is used by the routine at Handler_Balloon.
Stun_Hazard_And_Score 74FF CALL CancelEggDrop Call CancelEggDrop.
7502 LD A,$14 Jump to AddToScore to add 14 points to the score.
7504 JP AddToScore
Prev: 74B9 Up: Map Next: 7507