![]() |
Routines |
| Prev: E25B | Up: Map | Next: E2B0 |
|
Used by the routine at D09B.
|
||||
|
Called from D0E3 if byte 7 or 8 of missile data (6CDC/EB9D) is repelled by the active spell effect
Collision detection for SHIELD, PROTECT, DEFENCE and AMULET vs missile/bolt spells.
Because the shield effect flickers to Maroc's left and right, his 'hit boxes' are slightly wider than normal to accommodate this (vertical = 24 pixels at E297, horizontal 48 pixels at E2A2)
|
||||
| E286 | LD A,($EAD4) | High byte of missile horizontal co-ordinate | ||
| E289 | CP $00 | This byte is 0 if the item is visible on-screen | ||
| E28B | JR NZ,$E2AD | If not, jump to the end of this routine | ||
|
Missile is on-screen. First a horizontal co-ordinate collision check:
|
||||
| E28D | LD A,($EAD2) | Graphic's vertical pixel position | ||
| E290 | LD C,A | Copy to C register | ||
| E291 | LD A,($EAC1) | Maroc's vertical (Y-axis) screen position | ||
| E294 | ADD A,$0C | Move the target centre down 12 pixels (towards the bottom of Maroc's sprite). The vertical 'hit box' of 24 pixels will extend upwards from here | ||
| E296 | SUB C | Subtract the missile's vertical position | ||
| E297 | CP $18 | Is the missile within 24 pixels from this vertical position? | ||
| E299 | JR NC,$E2AD | If margin is >=24 pixels, it's missed vertically so no need to run the horizontal check | ||
|
Horizontal check is within 'hit box'. Next, a vertical co-ordinate collision check:
|
||||
| E29B | LD A,($EAD3) | Graphic's horizontal pixel position | ||
| E29E | LD C,A | Copy to C register | ||
| E29F | LD A,$8C | Maroc's horizontal pixel position on screen doesn't change - this pixel position is at the barrier just to the right hand size of Maroc's sprite. The horizontal 'hit box' of 48 pixels extends to the left from here | ||
| E2A1 | SUB C | Subtract the missile's horizontal pixel position | ||
| E2A2 | CP $30 | Is the missile within 48 pixels from this horizontal position? | ||
| E2A4 | JR NC,$E2AD | If it's outside this range, no collision | ||
|
The missile has collided with Maroc while he's protected by his shielding spell:
|
||||
| E2A6 | LD A,$08 | |||
| E2A8 | LD ($EB56),A | Set the sound effect duration affecting length of 'crunching' sound as the missile strikes Maroc & his shield (duration = 8) This also acts as a non-zero collision flag value, indicating a positive collision check |
||
| E2AB | JR $E2AF | ...and skip the next instruction, jump straight to RET | ||
|
No collision detected
|
||||
| E2AD | LD A,$00 | Collision check flag value = 0 (no collision) | ||
| E2AF | RET | |||
| Prev: E25B | Up: Map | Next: E2B0 |