Prev: 34546 Up: Map Next: 34655
34586: Handle Blob
The handler for the blob (sprite IDs 96 and 97). A new random velocity is chosen every 17 steps, by counting down the counter at offset 13. The movement itself is done by MoveCreature.
Input
IX The blob entity
HandlerBlob 34586 CALL StoreEntity Call StoreEntity to save the position of the blob.
34589 LD A,(60049) Fetch the room of the player from PlayerRoom.
34592 CP (IX+1) Jump to CountDownCreature if the blob is not in the same room as the player.
34595 JP NZ,CountDownCreature
34598 LD HL,24101 Point HL at the number of creatures at NumCreatures.
34601 INC (HL) Increment the number of creatures by one.
34602 LD (IX+15),0 Write 0 to offset 15 of the blob, so it is not removed.
34606 CALL CheckPlayerTouch Call CheckPlayerTouch to check whether the entity is touching the player.
34609 DEC E Jump to HandleTouchingCreature if the blob touched the player.
34610 JP Z,HandleTouchingCreature
34613 CALL CheckWeaponHit Call CheckWeaponHit to check whether the weapon has hit the entity.
34616 DEC E Jump to PopCreature if the blob was hit by a weapon.
34617 JP Z,PopCreature
34620 LD DE,(24093) Fetch the size of the room from CurrentRoom_Width.
34624 DEC (IX+13) Decrease the counter at offset 13 by one.
34627 JR NZ,HandlerBlob_Animate Jump to HandlerBlob_Animate if it is not zero.
34629 LD (IX+13),17 Set the counter to 17.
34633 CALL RandomiseVelocity Call RandomiseVelocity to give the creature a new random velocity.
Animate the blob by changing the sprite every other step.
HandlerBlob_Animate 34636 LD A,(IX+13) Fetch the counter.
34639 RRA Halve the counter.
34640 AND %00000001 Keep only bit 0.
34642 LD C,A Keep the animation frame in C.
34643 LD A,(IX+0) Fetch the sprite ID of the blob.
34646 AND %11111110 Reset bit 0.
34648 ADD A,C Add the animation frame to the sprite ID.
34649 LD (IX+0),A Update the sprite ID of the blob.
34652 JP MoveCreature Jump to MoveCreature to move the creature.
Prev: 34546 Up: Map Next: 34655