jetpac | Routines |
Prev: 6bf1 | Up: Map | Next: 6cb0 |
|
||||||||
6bf8 | ld hl,$5dcb | Increment current alien number | ||||||
6bfb | inc (hl) | |||||||
6bfc | call $6cb0 | Update actor direction | ||||||
6bff | xor a | |||||||
6c00 | ld ($5dc9),a | Reset alien new direction flag | ||||||
6c03 | call $6e1b | Fire laser beam (returns C) | ||||||
6c06 | dec c | |||||||
6c07 | ld bc,$0040 | 40 points (decimal value) | ||||||
6c0a | jp z,$6d5c | Kill Alien SFX #2 if alien is dead | ||||||
6c0d | call $6de9 | Alien collision check (returns E) | ||||||
6c10 | dec e | |||||||
6c11 | jp z,$6456 | Alien killed by collision if E is zero | ||||||
Check which direction alien is travelling after hitting a platform.
|
||||||||
6c14 | call $75e8 | Platform collision (returns E) | ||||||
6c17 | bit 2,e | Update alien Y position if bit-2 is reset | ||||||
6c19 | jr z,$6c30 | |||||||
6c1b | bit 7,e | Set alien direction to up if bit-7 set | ||||||
6c1d | jr nz,$6c94 | |||||||
6c1f | bit 4,e | Set alien direction to down if bit-4 set | ||||||
6c21 | jr nz,$6c9a | |||||||
Alien has hit the end of a platform: change direction.
|
||||||||
6c23 | ld a,e | Update alien "moving" value | ||||||
6c24 | and $40 | |||||||
6c26 | ld e,a | |||||||
6c27 | ld a,(ix+$04) | |||||||
6c2a | and $bf | |||||||
6c2c | or e | |||||||
6c2d | ld (ix+$04),a | |||||||
Update the alien Vertical position.
|
||||||||
6c30 | bit 0,(ix+$04) | Check alien moving direction | ||||||
6c34 | jr nz,$6c5b | Update Y position if vertical movement | ||||||
6c36 | ld a,($5dce) | E=random number | ||||||
6c39 | ld e,a | |||||||
6c3a | and $0f | |||||||
6c3c | jr nz,$6c5b | Jump if != 0 | ||||||
6c3e | set 0,(ix+$04) | else set "moving" bit-0 | ||||||
6c42 | ld a,($5dcc) | Use Game timer to Y speed | ||||||
6c45 | and $1f | |||||||
6c47 | add a,$10 | |||||||
6c49 | ld (ix+$06),a | |||||||
6c4c | ld a,e | A=original random number | ||||||
6c4d | and $80 | |||||||
6c4f | ld e,a | E = 0 or 128 | ||||||
6c50 | ld a,(ix+$04) | Update alien "moving" to either 127 or 255 | ||||||
6c53 | and $7f | |||||||
6c55 | or e | |||||||
6c56 | ld (ix+$04),a | |||||||
6c59 | jr $6c14 | Jump back and repeat collision check | ||||||
Update the alien Horizontal position.
|
||||||||
6c5b | bit 0,(ix+$04) | Check alien "moving" | ||||||
6c5f | jr z,$6c78 | Update X position if horizontal movement | ||||||
6c61 | ld a,(ix+$02) | else update Y position | ||||||
Update the alien Y position, first checking if within the upper/lower bounds of the screen.
|
||||||||
6c64 | bit 7,(ix+$04) | Check moving up/down bit | ||||||
6c68 | jr z,$6ca0 | If moving up, subtract 2 from direction (via jump) | ||||||
6c6a | add a,$02 | otherwise, we add 2 to move down | ||||||
6c6c | ld (ix+$02),a | Set new Y position +/- 2 | ||||||
6c6f | dec (ix+$06) | Decrement Y speed | ||||||
6c72 | jr nz,$6c78 | |||||||
6c74 | res 0,(ix+$04) | Reset bit-0 of alien "moving" if speed is zero | ||||||
Update the alien X position.
|
||||||||
6c78 | ld a,(ix+$01) | A=X position (fetch before the jump) | ||||||
6c7b | bit 6,(ix+$04) | Check moving left/right bit | ||||||
6c7f | jr z,$6cac | If moving left, subtract 2 from direction (via jump) | ||||||
6c81 | add a,$02 | otherwise, we add 2 to move right | ||||||
6c83 | ld (ix+$01),a | Set new X position +/- 2 | ||||||
Draw the alien if a new direction is set, otherwise repeat platform collision check again.
|
||||||||
6c86 | ld a,($5dc9) | Draw the alien if the new direction flag is set, otherwise, increment the value | ||||||
6c89 | and a | |||||||
6c8a | jp nz,$6d43 | |||||||
6c8d | inc a | |||||||
6c8e | ld ($5dc9),a | |||||||
6c91 | jp $6c14 | Jump back and repeat collision check | ||||||
Change alien moving direction to up.
|
||||||||
6c94 | res 7,(ix+$04) | |||||||
6c98 | jr $6c30 | |||||||
Change alien moving direction to down.
|
||||||||
6c9a | set 7,(ix+$04) | |||||||
6c9e | jr $6c30 | |||||||
Subtract 2 from the Y position (move up), unless it has reached top of screen.
|
||||||||
6ca0 | sub $02 | |||||||
6ca2 | cp $28 | |||||||
6ca4 | jr nc,$6c6c | Return if not at top of screen | ||||||
6ca6 | set 7,(ix+$04) | Otherwise, set to moving down | ||||||
6caa | jr $6c6c | |||||||
Subtract 2 from horizontal direction.
|
||||||||
6cac | sub $02 | |||||||
6cae | jr $6c83 |
Prev: 6bf1 | Up: Map | Next: 6cb0 |