Routines |
Prev: 53787 | Up: Map | Next: 53870 |
Used by the routine at 53714.
|
||||
Maroc loses a very small amount of energy (1) if he collides with a tunnel boundary.
This routine checks Maroc's position against that of either the left (53840) or right (53819) boundary (determined at 53721).
RIGHT boundary wall check - compare boundary wall position against Maroc's position
Vertical position check:
|
||||
53819 | LD A,(60234) | Boundary wall's vertical (pixel) position | ||
53822 | SUB 80 | Subtract 80 (pixels) from this value | ||
53824 | CP 16 | |||
53826 | JP NC,53885 | If the difference is >=16, it's NOT within Maroc's vertical 'hit box' area (jump out here) | ||
Horizontal position check:
|
||||
53829 | LD A,(60232) | Boundary wall's horizontal (half-character/4-pixel) position | ||
53832 | CP 32 | Check vs 32 (= 16 character squares = the right hand side of Maroc's sprite graphic) | ||
53834 | JR NC,53867 | If no carry (NC), Maroc ISN'T beyond the tunnel boundary, so can jump out here | ||
53836 | LD A,32 | Maroc has hit/passed the boundary wall. Pre-load the value to assign to Maroc's speed to +32 = full speed left, as Maroc bounces off the wall |
||
53838 | JR 53859 | |||
LEFT boundary wall check - compare boundary wall position against Maroc's position
Vertical position check:
|
||||
53840 | LD A,(60234) | Boundary wall's vertical (pixel) position | ||
53843 | SUB 80 | Subtract 80 (pixels) from this value | ||
53845 | CP 16 | |||
53847 | JP NC,53885 | If the difference is >=16, it's not within Maroc's vertical 'hit box' area (jump out here) | ||
Horizontal position check:
|
||||
53850 | LD A,(60232) | Boundary wall's horizontal (half-character/4-pixel) position | ||
53853 | CP 24 | Check vs 24 ( = 12 character squares = the left hand side of Maroc's sprite graphic) | ||
53855 | JR C,53867 | If there's a carry, Maroc ISN'T beyond the tunnel boundary, so jump out here | ||
53857 | LD A,224 | Maroc has hit/passed the boundary wall. Pre-load the value to assign to Maroc's speed to 224 (-32) = full speed right, as Maroc bounces off the wall |
||
Maroc has hit a boundary wall
|
||||
53859 | LD (60164),A | Store Maroc's adjusted speed (after bouncing off either wall) | ||
53862 | LD A,1 | Set energy drain amount to 1 | ||
53864 | CALL 58316 | Decrease Maroc's energy | ||
53867 | JP 53885 |
Prev: 53787 | Up: Map | Next: 53870 |