Prev: D942 Up: Map Next: D978
D94F: Update Monster
The routine for objects of type 60 to 6F, the monsters. A monster moves about, changing direction from time to time, and kills the player if it touches the player.
UpdateMonster D94F LD A,(IX+$00) Set the offset of the pitches for the monster from its type.
D952 RLCA
D953 RLCA
D954 AND $F0
D956 LD C,A
D957 LD B,$00
D959 LD HL,$C35D 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.
D95C CALL PlayFlaggedSound
D95F LD A,(IX+$05) Set the velocity of the monster from its speed and direction.
D962 CALL SetVelocityFromSpeed
D965 CALL TestMove Check whether the scenery blocks the move.
D968 CALL MoveObject Move the monster.
D96B CALL UpdateDirection Turn the monster to a new direction if its timer has run out.
D96E CALL SetSpriteFromDirection Choose the sprite from the direction that the monster faces.
D971 CALL CheckPlayerCollision Return if the monster is not touching the player.
D974 RET NC
D975 JP KillPlayer Kill the player.
Prev: D942 Up: Map Next: D978