Prev: 55618 Up: Map Next: 55672
55631: Update Monster
The routine for objects of type 96 to 111, the monsters. A monster moves about, changing direction from time to time, and kills the player if it touches the player.
UpdateMonster 55631 LD A,(IX+0) Set the offset of the pitches for the monster from its type.
55634 RLCA
55635 RLCA
55636 AND 240
55638 LD C,A
55639 LD B,0
55641 LD HL,50013 Play the sound for the monster if it has been drawn. BC holds only the offset of the pitches, so they are read from the ROM, and the address of the table that is loaded into HL is not used.
55644 CALL PlayFlaggedSound
55647 LD A,(IX+5) Set the velocity of the monster from its speed and direction.
55650 CALL SetVelocityFromSpeed
55653 CALL TestMove Check whether the scenery blocks the move.
55656 CALL MoveObject Move the monster.
55659 CALL UpdateDirection Turn the monster to a new direction if its timer has run out.
55662 CALL SetSpriteFromDirection Choose the sprite from the direction that the monster faces.
55665 CALL CheckPlayerCollision Return if the monster is not touching the player.
55668 RET NC
55669 JP KillPlayer Kill the player.
Prev: 55618 Up: Map Next: 55672