Prev: 29881 Up: Map Next: 29959
29910: 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 29910 PUSH IY Stash the hazard state pointer on the stack.
29912 LD IY,56000 Point IY at Percy_X_Position (Percy's sprite data).
29916 CALL CheckSpriteCollision Call CheckSpriteCollision to check if the hazard collides with Percy.
29919 POP IY Restore the hazard state pointer from the stack.
29921 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 29923 LD (24487),A Write the collision result to *FallingState.
29926 CALL PlayHitSound Call PlayHitSound.
29929 RET Return.
No collision with Percy; check if Percy's egg is active and whether it hits the hazard.
Check_Egg_Hit 29930 LD A,(24489) Return if *EggDropFlag is zero (no egg active).
29933 OR A
29934 RET Z
29935 PUSH IY Stash the hazard state pointer on the stack.
29937 LD IY,56032 Point IY at Egg_X_Position.
29941 CALL CheckEggCollision Call CheckEggCollision.
29944 POP IY Restore the hazard state pointer from the stack.
29946 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 29947 LD (IY+0),128 Write 128 to *IY+0 to set bit 7 (mark the hazard as stunned).
This entry point is used by the routine at Handler_Balloon.
Stun_Hazard_And_Score 29951 CALL CancelEggDrop Call CancelEggDrop.
29954 LD A,20 Jump to AddToScore to add 20 points to the score.
29956 JP AddToScore
Prev: 29881 Up: Map Next: 29959