Prev: BED6 Up: Map Next: BF2F
BEE0: Handle Extra Life
The handler for an extra life (object 0C). When the player touches it the object turns into a sparkle, it is removed from the table of special objects, the egg tops are allowed to move again and a life is added and printed in the panel. An extra life which has not been touched is moved with gravity and makes a sound when it moves.
Input
IX The address of the object
Test whether the player is near.
HandleExtraLife BEE0 CALL SetPixelAdjustments_ExtraLife Call SetPixelAdjustments_ExtraLife.
BEE3 PUSH IX Copy IX to IY (using the stack).
BEE5 POP IY
BEE7 LD IX,$5B88 Point IX at PlayerBottomObject.
BEEB INC (IX+$04) Make the player a little wider.
BEEE INC (IX+$05) Make the player a little deeper.
BEF1 CALL TestNearObject Call TestNearObject.
BEF4 DEC (IX+$04) Put the width of the player back.
BEF7 DEC (IX+$05) Put the depth of the player back.
BEFA PUSH IY Copy IY to IX (using the stack).
BEFC POP IX
BEFE JR NC,HandleExtraLife_Move Jump to HandleExtraLife_Move if the player is not near.
Collect the extra life.
BF00 LD (IX+$00),$40 Set the sprite number to 40.
BF04 CALL SetPixelAdjustments_Sparkle Call SetPixelAdjustments_Sparkle.
BF07 LD L,(IX+$10) Fetch the low byte of the table entry address.
BF0A LD H,(IX+$11) Fetch the high byte.
BF0D XOR A Write 00 to the table entry and to *EggTopDisabledFlag.
BF0E LD (HL),A
BF0F LD ($5B3B),A
BF12 LD HL,$5B1A Add one life to Lives.
BF15 INC (HL)
BF16 CALL PlayLowBeep Call PlayLowBeep.
BF19 CALL PrintLives Call PrintLives.
BF1C LD BC,$0080 Copy the lives to the screen at (80, 00).
BF1F CALL CopyAreaToScreen
Move the extra life if it was not collected.
HandleExtraLife_Move BF22 CALL ApplyGravityAndMove Call ApplyGravityAndMove.
BF25 CALL TestObjectMoving Call TestObjectMoving.
BF28 RET Z Return if the object is not moving.
BF29 CALL ClearSpeed Call ClearSpeed.
BF2C JP PlaySoundAndRedraw Jump to PlaySoundAndRedraw.
View the equivalent code in;
Prev: BED6 Up: Map Next: BF2F