Prev: F3A3 Up: Map Next: F3FD
F3AB: Room logic : The Sewer
F3AB LD A,$40 Touching the shark drops endurance by 64, which can kill a player pretty quickly.
F3AD LD ($F26E),A
F3B0 LD IX,$F3A3 Point IX to the movement table. (F3A3)
Make sure the shark is facing the right way.
F3B4 LD A,(IX+$02) Get the distance to move in X.
F3B7 CP $02 Compare it to +2 ie: moving right.
F3B9 LD A,($F046) Get the shark's direction.
F3BC JR Z,$F3C4 If the distance is positive, nothing to do.
Shark should be facing left.
F3BE OR A Is the direction 0? (left)
F3BF CALL NZ,$F047 If not, need to flip the shark the other way round.
F3C2 JR $F3C8
Shark should be facing right.
F3C4 OR A Is the direction 0? (left)
F3C5 CALL Z,$F047 If so, need to flip the shark the other way round.
Now draw the shark.
F3C8 LD A,$30 Set the object ID to be the shark's head.
F3CA LD BC,$F3A1 Point BC to the bounds table. (F3A1)
F3CD CALL $EF35 Update the position.
F3D0 CALL $A8A0 Draw the graphic.
F3D3 LD A,($F3A0) Get the next ID for the shark's body.
F3D6 XOR $02 Cycle bit 2 so it changes between 2D and 2F.
F3D8 LD ($F3A0),A
F3DB CALL $EF35 Update the position.
F3DE CALL $A8A0 Draw the graphic.
Check to see if the player has the meat.
F3E1 LD A,($BD78) Get the item in the sewer.
F3E4 CP $17 Is it the meat?
F3E6 RET Z If so, the shark won't harm the player, so return.
F3E7 LD A,$17 Otherwise, is the player's first item the meat?
F3E9 CP (IY+$50)
F3EC RET Z Return if it is.
F3ED CP (IY+$55) Otherwise, is the player's second item the meat?
F3F0 RET Z Return if it is.
The player doesn't have the meat, if they touch the shark it's bad news.
F3F1 LD A,($A839) Move up two rows and check collision detection.
F3F4 SUB $10
F3F6 LD ($A839),A
F3F9 CALL $E329
F3FC RET Return.
Prev: F3A3 Up: Map Next: F3FD