Routines |
Prev: F047 | Up: Map | Next: F0B7 |
Used by the routine at EFC7.
|
||||
F057 | LD A,($F046) | Get the shark's direction. | ||
F05A | OR A | Is it facing left? | ||
F05B | CALL NZ,$F047 | If not, reverse the graphic so it is. | ||
F05E | LD HL,($F0BD) | Put the x co-ordinate in L and set the y co-ordinate to 98. | ||
F061 | LD H,$98 | |||
F063 | LD A,$30 | Set the object ID to be the shark's head (88F8) | ||
F065 | LD ($A838),HL | Set the position. | ||
F068 | CALL $A8A0 | Put the object in the sprite buffer. | ||
F06B | LD H,$A8 | Set the y co-ordinate to A8. | ||
F06D | LD ($A838),HL | Set the position. | ||
F070 | LD A,($F3A0) | Get the object ID of the shark's body. | ||
F073 | XOR $02 | Toggle bit 2, so it alternates between 2D and 2F. | ||
F075 | LD ($F3A0),A | |||
F078 | CALL $A8A0 | Put the object in the sprite buffer. | ||
F07B | LD A,$0C | Touching the shark drops endurance by 0C. | ||
F07D | LD ($F26E),A | |||
F080 | CALL $E329 | Check for collision detection. | ||
F083 | LD A,(IY+$0A) | Get the player's Y co-ordinate. | ||
F086 | CP $98 | Is it 98 ie: ground level. | ||
F088 | RET NZ | Return if it is, chase hasn't started. | ||
The chase is on.
|
||||
F089 | LD HL,$F0BD | Point HL to the shark's x co-ordinate. | ||
F08C | LD A,(HL) | Has the shark caught up with the player? | ||
F08D | SUB (IY+$05) | |||
F090 | SUB $01 | |||
F092 | CP $FE | |||
F094 | JR NC,$F09A | Jump forward if it has, it doesn't need to chase any more. | ||
F096 | LD A,(HL) | Otherwise decrement the X co-ordinate by 2. | ||
F097 | SUB $02 | |||
F099 | LD (HL),A | |||
F09A | LD A,(HL) | Is the shark close enough to the player to attack? | ||
F09B | SUB (IY+$05) | |||
F09E | SUB $0C | |||
F0A0 | CP $E0 | |||
F0A2 | JR C,$F0AE | Jump forward if it isn't. | ||
The shark is close enough to attack the player, so don't make them advance otherwise they'll overtake and not attack anymore.
|
||||
F0A4 | INC (HL) | Increment the X co-ordinate. | ||
F0A5 | LD A,($F0E4) | Get the number of ticks in this run. | ||
F0A8 | INC A | Increment it. | ||
F0A9 | CP $05 | Return if it doesn't equal 5 yet. | ||
F0AB | RET Z | |||
F0AC | JR $F0B3 | Otherwise set it to that value. | ||
The shark isn't close enough yet.
|
||||
F0AE | LD A,($F0E4) | Get the number of ticks in this run. | ||
F0B1 | DEC A | Decrement it. | ||
F0B2 | RET Z | Return if it doesn't equal 0 yet. | ||
F0B3 | LD ($F0E4),A | Otherwise set it to that value and return. | ||
F0B6 | RET |
Prev: F047 | Up: Map | Next: F0B7 |