Prev: D251 Up: Map Next: D2DE
D2AD: Run Crumbling Block
The handler of the object types 88 to 8B, which are the stages of a block that crumbles away. Each time that the player or a block of type 5B lands on it, it changes to the next type, which has the next sprite, and after the last it is erased.
Input
IX Object record
Crumble one stage when something lands on the block.
RunCrumblingBlock D2AD CALL SetSpriteOffset_Minus16_Minus8 Call SetSpriteOffset_Minus16_Minus8 to set the offsets of the sprite.
D2B0 LD (IX+$0B),$00 Set the speed along z to zero.
D2B4 CALL ApplyGravityAndMove_Move Call ApplyGravityAndMove_Move to move the block, without gravity.
D2B7 BIT 7,(IX+$17) Return if nothing has landed on the block.
D2BB RET Z
D2BC RES 7,(IX+$17) Clear the flag for something having landed on the block.
D2C0 BIT 3,(IX+$0D) Return if there is nothing on the block.
D2C4 RET Z
D2C5 RES 3,(IX+$0D) Clear the flag for something being on the block.
D2C9 LD A,(IX+$00) Fetch the type of the block.
D2CC CP $8B Jump to RunCrumblingBlock_Erase if it is the last of the types.
D2CE JR Z,RunCrumblingBlock_Erase
D2D0 INC A Move on to the next type.
D2D1 LD (IX+$00),A Set the type.
D2D4 JP SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags to flag the block as moved.
Erase the last stage of the block.
RunCrumblingBlock_Erase D2D7 LD (IX+$00),$01 Change the block to the type 01, which makes DrawObject erase it.
D2DB JP SetWipeAndDrawFlags Jump to SetWipeAndDrawFlags to flag the block as moved.
Prev: D251 Up: Map Next: D2DE