| jetpac | Routines | 
| Prev: 6361 | Up: Map | Next: 6456 | 
  | 
||||||||
| 63a3 | ld hl,$5dcb | Increment current alien number | ||||||
| 63a6 | inc (hl) | |||||||
| 63a7 | call $6cb0 | Update Alien direction | ||||||
| 63aa | ld a,(ix+$04) | Alien "moving" field | ||||||
| 63ad | ld hl,$0000 | |||||||
| 63b0 | bit 1,a | Move if bit-1 is set | ||||||
| 63b2 | jr nz,$63ec | |||||||
| 63b4 | call $63d1 | Check and update speed | ||||||
| 63b7 | ld a,($5d02) | A=Jetman Y position | ||||||
| 63ba | sub $0c | |||||||
| 63bc | cp (ix+$02) | Update Alien speed if Jetman Y position-12 equals Alien Y position | ||||||
| 63bf | call z,$63d7 | |||||||
| 63c2 | ld a,($5dcc) | A=LSB of game timer | ||||||
| 63c5 | and $40 | |||||||
| 63c7 | jr z,$63cd | Move vertically if bit-6 is reset | ||||||
| 63c9 | inc h | |||||||
| 63ca | inc h | |||||||
| 63cb | inc h | |||||||
| 63cc | inc h | |||||||
| 63cd | dec h | |||||||
| 63ce | dec h | |||||||
| 63cf | jr $6406 | Move vertically +2 or -2 | ||||||
| 
 
Decide if speed should be updated.
 
 | 
||||||||
| 63d1 | ld a,($5dce) | A=random number | ||||||
| 63d4 | and $1f | |||||||
| 63d6 | ret nz | Return if not zero | ||||||
| 
 
Update speed.
 
 | 
||||||||
| 63d7 | set 1,(ix+$04) | Alien "moving" field | ||||||
| 63db | ld c,a | C=Jetman Y position-12 ? | ||||||
| 63dc | ld a,($5dcc) | A=LSB of game timer | ||||||
| 63df | add a,c | |||||||
| 63e0 | and $7f | |||||||
| 63e2 | or $20 | |||||||
| 63e4 | ld (ix+$05),a | Set new X speed value | ||||||
| 63e7 | ld (ix+$03),$47 | Set "colour" to White | ||||||
| 63eb | ret | |||||||
| 
 
Move Jet Fighter horizontally.
 
 | 
||||||||
| 63ec | dec (ix+$05) | Decrement alien X speed | ||||||
| 63ef | jr z,$644a | Jet Fighter killed if X speed is zero | ||||||
| 63f1 | ld a,$04 | A=default speed | ||||||
| 63f3 | bit 6,(ix+$00) | Check bit-6 of Alien "direction" | ||||||
| 63f7 | jr z,$63fb | |||||||
| 63f9 | neg | |||||||
| 63fb | ld l,a | L=$FC or $04? | ||||||
| 
 
Target the player and move towards them.
 
 | 
||||||||
| 63fc | ld a,($5d02) | Move upwards if Jetman Y position higher than Alien Y position | ||||||
| 63ff | cp (ix+$02) | |||||||
| 6402 | jr c,$63cd | |||||||
| 6404 | jr $63c9 | else, move down | ||||||
| 
 
Move Jet Fighter vertically and horizontally.
 
 | 
||||||||
| 6406 | ld a,(ix+$00) | Alien "direction" | ||||||
| 6409 | and $c0 | Reset FLY and WALK bits | ||||||
| 640b | or $03 | |||||||
| 640d | ld (ix+$00),a | Update "direction" value | ||||||
| 6410 | ld a,(ix+$01) | Update Alien X position (L is probably 3 or 4) | ||||||
| 6413 | add a,l | |||||||
| 6414 | ld (ix+$01),a | |||||||
| 6417 | ld a,(ix+$02) | Update Alien Y position | ||||||
| 641a | add a,h | |||||||
| 641b | ld (ix+$02),a | |||||||
| 641e | call $7232 | Update Actor Position X and draw | ||||||
| 6421 | call $7197 | Colourize the sprite | ||||||
| 6424 | ld a,(ix+$02) | Kill Fighter if Y position < $28 | ||||||
| 6427 | cp $28 | |||||||
| 6429 | jr c,$644a | |||||||
| 642b | call $6e1b | Fire laser beam - returns C | ||||||
| 642e | bit 0,c | Kill if a laser hit the Alien | ||||||
| 6430 | jr nz,$644a | |||||||
| 6432 | call $75e8 | Platform collision - returns E | ||||||
| 6435 | bit 2,e | Kill if Alien hit a platform | ||||||
| 6437 | jr nz,$644a | |||||||
| 6439 | call $6de9 | Alien collision - returns DE | ||||||
| 643c | dec e | |||||||
| 643d | jr z,$6456 | Alien killed by collision | ||||||
| 643f | ld a,(ix+$00) | Update Alien "direction" | ||||||
| 6442 | and $c0 | |||||||
| 6444 | or $07 | |||||||
| 6446 | ld (ix+$00),a | |||||||
| 6449 | ret | |||||||
| 
 
Jet Fighter is dead. Added score and make exploding sound.
 
 | 
||||||||
| 644a | ld bc,$0055 | 55 points for a dead jet fighter (decimal value) | ||||||
| 644d | call $70c2 | Add points to score | ||||||
| 6450 | call $67b6 | Exploding jet fighter SFX - actually Thruster SFX! | ||||||
| 6453 | jp $685d | Update current alien state | ||||||
| Prev: 6361 | Up: Map | Next: 6456 |