jetpac | Routines |
Prev: 6a2d | Up: Map | Next: 6ab8 |
|
||||||||
6a35 | ld hl,$5dcb | Increment current alien number | ||||||
6a38 | inc (hl) | |||||||
6a39 | call $6cb0 | Update actor direction | ||||||
6a3c | call $6e1b | Fire laser beam (returns C) | ||||||
6a3f | dec c | |||||||
6a40 | jp z,$6aaf | Add the points for a kill if alien is dead | ||||||
6a43 | call $6de9 | Alien collision check (returns E) | ||||||
6a46 | dec e | |||||||
6a47 | jp z,$6456 | Alien killed by collision if E is zero | ||||||
6a4a | xor a | |||||||
6a4b | ld ($5dc9),a | Reset alien new direction flag | ||||||
Check which direction alien is travelling after hitting a platform.
|
||||||||
6a4e | call $75e8 | Platform collision (returns E) | ||||||
6a51 | bit 2,e | Update alien X position if bit-2 is reset | ||||||
6a53 | jr z,$6a6a | |||||||
6a55 | bit 7,e | Set alien direction to up if bit-7 set | ||||||
6a57 | jr nz,$6a93 | |||||||
6a59 | bit 4,e | Set alien direction to down if bit-4 set | ||||||
6a5b | jr nz,$6a99 | |||||||
Alien has hit the end of a platform: change direction.
|
||||||||
6a5d | ld a,e | Update alien "moving" value | ||||||
6a5e | and $40 | |||||||
6a60 | ld e,a | |||||||
6a61 | ld a,(ix+$04) | |||||||
6a64 | and $bf | |||||||
6a66 | or e | |||||||
6a67 | ld (ix+$04),a | |||||||
Update the alien X position.
|
||||||||
6a6a | bit 6,(ix+$04) | Check alien moving left/right bit | ||||||
6a6e | ld a,(ix+$01) | A=alien X position (fetch before the jump) | ||||||
6a71 | jr z,$6a9f | If moving left, subtract 2 from direction (via jump) | ||||||
6a73 | add a,$02 | otherwise, we add 2 to move right | ||||||
6a75 | ld (ix+$01),a | Set new X position +/- 2 | ||||||
Update the alien Y position, first checking if within the upper/lower bounds of the screen.
|
||||||||
6a78 | bit 7,(ix+$04) | Check alien moving up/down bit | ||||||
6a7c | ld a,(ix+$02) | A=alien Y position (fetch before the jump) | ||||||
6a7f | jr z,$6aa3 | If moving up, subtract 2 from direction (via jump) | ||||||
6a81 | add a,$02 | otherwise, we add 2 to move down | ||||||
6a83 | ld (ix+$02),a | Set new alien Y position +/- 2 | ||||||
Draw the alien if new direction is set, otherwise repeat collision check again.
|
||||||||
6a86 | ld a,($5dc9) | Draw the alien if the new direction flag is set, otherwise, increment the value | ||||||
6a89 | and a | |||||||
6a8a | jp nz,$6d43 | |||||||
6a8d | inc a | |||||||
6a8e | ld ($5dc9),a | |||||||
6a91 | jr $6a4e | Jump back and repeat collision check | ||||||
Change alien moving direction to up.
|
||||||||
6a93 | res 7,(ix+$04) | |||||||
6a97 | jr $6a6a | |||||||
Change alien moving direction to down.
|
||||||||
6a99 | set 7,(ix+$04) | |||||||
6a9d | jr $6a6a | |||||||
Subtract 2 from the X position (move left).
|
||||||||
6a9f | sub $02 | |||||||
6aa1 | jr $6a75 | |||||||
Subtract 2 from the Y position (move up), unless it has reached top of screen.
|
||||||||
6aa3 | sub $02 | |||||||
6aa5 | cp $24 | |||||||
6aa7 | jr nc,$6a83 | Return if not at top of screen | ||||||
6aa9 | set 7,(ix+$04) | Otherwise, set alien to moving down. | ||||||
6aad | jr $6a83 | |||||||
Add score to player if alien is dead.
|
||||||||
6aaf | ld bc,$0080 | 80 points (decimal value) | ||||||
6ab2 | call $70c2 | Add points to score | ||||||
6ab5 | jp $6bf1 | Kill Alien SFX #1 |
Prev: 6a2d | Up: Map | Next: 6ab8 |