Prev: 54342 Up: Map Next: 54429
54393: Check if Maroc is on a room element/item that drains or restores his energy
Used by the routine at 54342.
stationary orb in room that restores Maroc's energy
This routine checks if Maroc is (floating) on top of an object of a type that drains or restores his energy.
Various stationary room objects e.g. fires, orbs and mushrooms, can either drain or restore Maroc's energy when he passes over them.
  • Energy draining objects drain 8 points of energy (per game frame)
  • Energy restoring objects restore 2 points of energy (per game frame)
54393 LD A,(60114) Maroc's vertical pixel position
54396 ADD A,8 Adjust the collision hit box 8 pixels down towards the base of Maroc's sprite, as the objects he's touching are supposed to be on the ground
54398 LD (60114),A ...and re-store as the vertical co-ordinate to check
Check for energy draining items:
54401 LD C,254 Collision type to check against - 254 = energy draining objects
54403 CALL 57293 Collision check routine - returns 0 (no collision) or 1 (collision found) in the A register
54406 CP 0
54408 JR Z,54415 If no collision, skip to the next check
54410 LD A,8 Otherwise, set energy drain amount to 8 points of energy
54412 CALL 58316 ...and reduce Maroc's energy by this amount
Check for energy restoring items:
54415 LD C,253 Collision type to check against - 253 = energy restoring objects
54417 CALL 57293 Collision check routine - returns 0 (no collision) or 1 (collision found) in the A register
54420 CP 0
54422 JR Z,54429 If no collision, skip over the next couple of instructions
54424 LD A,254 Otherwise, set energy drain amount to -2 (i.e. -2 drain, so INCREASE energy by 2)
54426 CALL 58316 ...increase Maroc's energy
Prev: 54342 Up: Map Next: 54429