Prev: D179 Up: Map Next: D1FF
D1D2: Check tunnel item type for collision checks and movement (boundary, bats and spiders)
Used by the routine at C89F.
Check for collisions with all tunnel objects (left/right boundary, bats or spiders).
  • Collision with a boundary wall drains Maroc's energy by 1 point
  • Collision with a spider or bat drains Maroc's energy by 16 points
D1D2 LD A,($EB4E) Object properties byte
D1D5 AND $01 Bit 1 indicates if the item is visible on-screen
D1D7 JR Z,$D21B If not, skip the rest of this routine
Check what tunnel object we're dealing with:
D1D9 LD A,($EB46) Tunnel boundary wall type. 1 = right, 2 = left
D1DC CP $01
D1DE JR Z,$D23B Right boundary wall check
D1E0 CP $02
D1E2 JR Z,$D250 Left boundary wall check
If it's not a right/left boundary wall, the item must be a creature - spider or bat.
In which case, run a collision check with Maroc and reduce his energy if a collision is detected.
D1E4 LD A,$02 Set the counter/length/frequency used for the generic sound effect routine at C07A as spiders and bats make a scuttling/flapping sound as they move down the tunnel
D1E6 LD ($EB56),A
D1E9 LD C,$00 Collision/event type to check - 0 = Collision with Maroc
D1EB CALL $DFCD Run event/collision check
D1EE CP $00 The A register is returned with 1 = Collision, 0 = No collision
D1F0 JR Z,$D1F7
D1F2 LD A,$10 If there's a collision...
D1F4 CALL $E3CC ...Reduce Maroc's energy (by 16)
Creature movement
D1F7 LD A,($EB46) Creature type. 4 = Spider, 8 = Bat
D1FA CP $08 Is it a bat?
D1FC JP NZ,$D27D If not, jump to spider movement
Prev: D179 Up: Map Next: D1FF