Prev: D446 Up: Map Next: D49D
D479: Check if Maroc is on a room element/item that drains or restores his energy
Used by the routine at D446.
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)
D479 LD A,($EAD2) Maroc's vertical pixel position
D47C ADD A,$08 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
D47E LD ($EAD2),A ...and re-store as the vertical co-ordinate to check
Check for energy draining items:
D481 LD C,$FE Collision type to check against - 254 = energy draining objects
D483 CALL $DFCD Collision check routine - returns 0 (no collision) or 1 (collision found) in the A register
D486 CP $00
D488 JR Z,$D48F If no collision, skip to the next check
D48A LD A,$08 Otherwise, set energy drain amount to 8 points of energy
D48C CALL $E3CC ...and reduce Maroc's energy by this amount
Check for energy restoring items:
D48F LD C,$FD Collision type to check against - 253 = energy restoring objects
D491 CALL $DFCD Collision check routine - returns 0 (no collision) or 1 (collision found) in the A register
D494 CP $00
D496 JR Z,$D49D If no collision, skip over the next couple of instructions
D498 LD A,$FE Otherwise, set energy drain amount to -2 (i.e. -2 drain, so INCREASE energy by 2)
D49A CALL $E3CC ...increase Maroc's energy
Prev: D446 Up: Map Next: D49D