Prev: 53273 Up: Map Next: 53349
53323: Creature collision check with room boundary and Maroc
Used by the routines at 52695, 52948, 53003, 53054 and 53080.
Check if a creature has collided with a room boundary or Maroc:
  • Uses the generic room boundary check routine at 57401 which checks for collision with the room walls, and if so, adjusts the creature's position
  • Checks if a creature is at Maroc's position on screen/in room
  • If so, reduce Maroc's energy based on the damage that creature type deals (last byte of creature data set at 27828)
  • If the creature is a WRAITH, check if the WRAITHBANE spell is active & if so destroy the wraith
53323 LD A,(60572) FREEZE spell timer counter (> 0 means the FREEZE spell is in effect)
53326 CP 0
53328 JR NZ,53392 Maroc doesn't lose energy if he touches stationary creatures when the FREEZE spell is in effect
Check creature is within room wall boundary, adjusting if needed:
53330 LD A,(60234) Creature's vertical pixel position in room
53333 ADD A,8 Adjust the vertical point to check for collisions 8 pixels down, towards the middle of the creature, rather than the top
53335 LD E,A Store in E register, which is what the room boundary is checked against
53336 CALL 57401 Run room boundary checks for creature, adjusting position accordingly if needed
Check collision detection with Maroc
53339 LD C,0 Collision event type 0 = collision with Maroc
53341 CALL 57293 Run collision check
53344 CP 0 The A register is returned with 1 = collision, or 0 = no collision
53346 JP Z,53885 If no collision, can jump out of the entire routine here
The next routine follows if a creature has collided with Maroc
Prev: 53273 Up: Map Next: 53349