Prev: 65E8 Up: Map Next: 6631
6607: Handle Monster
The handler for the monster (IDs 24 and 25), which pops up out of one of the dustbins at the bottom of the screen (it is created by CreateMonster). Byte 06 of the actor is its state, which chooses which code at HandleMonster_Rising is run using the table at MonsterStates. If a flour shot hits the monster it is coloured white (see TestFlourCollision), the points are added to the score, and it goes straight to the state in which it drops back into the dustbin.
Input
IX Actor
HandleMonster 6607 LD HL,$5F1B Point HL at the number of actors in play (ActorsInPlay).
660A INC (HL) Increase it by one.
660B CALL StoreEntity Record the position of the sprite using StoreEntity.
660E LD A,(IX+$03) Fetch the colour of the monster.
6611 CP $47 Jump to HandleMonster_State if it has been hit already.
6613 JR Z,HandleMonster_State
6615 CALL TestFlourCollision Test whether a flour shot has hit the actor using TestFlourCollision.
6618 BIT 7,(IX+$00) Jump to HandleMonster_State if the monster has not been hit by the flour shot (is bit 7 of the actor ID set).
661C JR Z,HandleMonster_State
661E LD (IX+$06),$02 Write 02 to the state of the monster, so that it drops back into the dustbin.
6622 LD BC,$0125 Set the points for hitting the monster (0125 in BCD).
6625 CALL AddPointsToScore Add the points to the score using AddPointsToScore.
HandleMonster_State 6628 LD HL,$6631 Point HL at the table of monster states.
662B LD A,(IX+$06) Fetch the state of the monster.
662E JP MainLoop_Dispatch Jump to MainLoop_Dispatch to run the code for the state.
Prev: 65E8 Up: Map Next: 6631