![]() |
Routines |
| Prev: 95B6 | Up: Map | Next: 970E |
|
Count the alien, then drift it relative to the scroll in Jetman_Position.
|
||||||||
| Handler_DriftingAlien | 9654 | LD HL,$5E5E | HL=AlienCount. | |||||
| 9657 | INC (HL) | Increase AlienCount by one. | ||||||
|
Compare the alien with Jetman_Position and pick a drift direction.
|
||||||||
| 9658 | LD H,(IX+$03) | Fetch the high byte of the world X. | ||||||
| 965B | LD L,(IX+$02) | Fetch the low byte of the world X. | ||||||
| 965E | LD DE,($607A) | Fetch Jetman_Position. | ||||||
| 9662 | AND A | Subtract the scroll position. | ||||||
| 9663 | SBC HL,DE | |||||||
| 9665 | BIT 4,H | Jump to Handler_DriftingAlien_DriftRight if the alien is left of the scroll. | ||||||
| 9667 | JP NZ,Handler_DriftingAlien_DriftRight | |||||||
|
Speed the alien up towards the left, up to a limit.
|
||||||||
| 966A | LD C,$00 | Clear the reverse-animation flag. | ||||||
| 966C | LD A,(IX+$05) | Jump to Handler_DriftingAlien_Decelerate if the horizontal speed is positive. | ||||||
| 966F | AND A | |||||||
| 9670 | JP P,Handler_DriftingAlien_Decelerate | |||||||
| 9673 | CP $D1 | Jump to Handler_DriftingAlien_Loop if the speed is already below D1. | ||||||
| 9675 | JR C,Handler_DriftingAlien_Loop | |||||||
| Handler_DriftingAlien_Decelerate | 9677 | SUB $02 | Subtract 02 from the speed. | |||||
| Handler_DriftingAlien_Loop | 9679 | LD (IX+$05),A | Write the speed back. | |||||
|
Aim the vertical thrust at Jetman, or at mid-screen when Jetman is in the rover.
|
||||||||
| 967C | LD A,($6078) | Fetch the Jetman type from Jetman_Slot. | ||||||
| 967F | CP $11 | Jump to Handler_DriftingAlien_FetchJetmanY if Jetman is on foot. | ||||||
| 9681 | JR C,Handler_DriftingAlien_FetchJetmanY | |||||||
| 9683 | LD A,$68 | A=68. | ||||||
| 9685 | JR Handler_DriftingAlien_CompareY | Jump to Handler_DriftingAlien_CompareY. | ||||||
| Handler_DriftingAlien_FetchJetmanY | 9687 | LD A,($607C) | Fetch Jetman_Y. | |||||
|
Compare with the alien's Y position and, if the alien is above the target, increase the downward thrust, up to a limit.
|
||||||||
| Handler_DriftingAlien_CompareY | 968A | SUB (IX+$04) | Subtract the alien's Y position. | |||||
| 968D | JP M,Handler_DriftingAlien_ThrustUp | Jump to Handler_DriftingAlien_ThrustUp if the alien is below the target. | ||||||
| 9690 | LD A,(IX+$06) | Jump to Handler_DriftingAlien_AddThrust if the vertical thrust is negative. | ||||||
| 9693 | AND A | |||||||
| 9694 | JP M,Handler_DriftingAlien_AddThrust | |||||||
| 9697 | CP $30 | Jump to Handler_DriftingAlien_ApplyThrust if the thrust is already at least 30. | ||||||
| 9699 | JR NC,Handler_DriftingAlien_ApplyThrust | |||||||
| Handler_DriftingAlien_AddThrust | 969B | ADD A,$02 | Add 02 to the thrust. | |||||
|
Apply the thrust to the alien's Y position, bouncing at the top and bottom.
|
||||||||
| Handler_DriftingAlien_ApplyThrust | 969D | LD (IX+$06),A | Write the thrust back. | |||||
| 96A0 | SRA A | Divide it by 10. | ||||||
| 96A2 | SRA A | |||||||
| 96A4 | SRA A | |||||||
| 96A6 | SRA A | |||||||
| 96A8 | ADD A,(IX+$04) | Add it to the alien's Y position. | ||||||
| 96AB | CP $38 | Jump to Handler_DriftingAlien_BounceTop if the alien is above the play area. | ||||||
| 96AD | JR C,Handler_DriftingAlien_BounceTop | |||||||
| 96AF | CP $B0 | Jump to Handler_DriftingAlien_BounceGround if the alien has hit the ground line. | ||||||
| 96B1 | JR NC,Handler_DriftingAlien_BounceGround | |||||||
| 96B3 | LD (IX+$04),A | Write the Y position back. | ||||||
|
Animate the frame and colour, then continue at PlaceSpawnedAlien_Age.
|
||||||||
| Handler_DriftingAlien_Animate | 96B6 | INC (IX+$11) | Increase the animation timer. | |||||
| 96B9 | LD A,(IX+$11) | Fetch the animation timer. | ||||||
| 96BC | AND %00000111 | Keep only bits 0-2. | ||||||
| 96BE | BIT 7,C | Jump to Handler_DriftingAlien_WriteFrame if the reverse-animation flag is set. | ||||||
| 96C0 | JR NZ,Handler_DriftingAlien_WriteFrame | |||||||
| 96C2 | XOR %00000111 | Flip bits 0-2. | ||||||
|
Sprite IDs begin at 48 ("The Blob: Frame 1").
|
||||||||
| Handler_DriftingAlien_WriteFrame | 96C4 | ADD A,$48 | Add 48 for the drifting frames. | |||||
| 96C6 | LD (IX+$00),A | Write it to the actor type. | ||||||
|
Alternate the colour using bit 0 of GameTimer.
|
||||||||
| 96C9 | LD A,($5E42) | Fetch GameTimer. | ||||||
| 96CC | RLA | Rotate it left once. | ||||||
| 96CD | AND %00000010 | Keep only bit 1. | ||||||
| 96CF | ADD A,$44 | Add 44 for the colour. | ||||||
| 96D1 | LD (IX+$07),A | Write it to the actor colour. | ||||||
| 96D4 | JP PlaceSpawnedAlien_Age | Jump to PlaceSpawnedAlien_Age. | ||||||
|
When the alien is left of the scroll, drift right.
|
||||||||
| Handler_DriftingAlien_DriftRight | 96D7 | LD C,$80 | Set the reverse-animation flag. | |||||
| 96D9 | LD A,(IX+$05) | Jump to Handler_DriftingAlien_AddSpeed if the horizontal speed is negative. | ||||||
| 96DC | AND A | |||||||
| 96DD | JP M,Handler_DriftingAlien_AddSpeed | |||||||
| 96E0 | CP $30 | Jump to Handler_DriftingAlien_Loop if the speed is already at least 30. | ||||||
| 96E2 | JR NC,Handler_DriftingAlien_Loop | |||||||
| Handler_DriftingAlien_AddSpeed | 96E4 | ADD A,$02 | Add 02 to the speed. | |||||
| 96E6 | JR Handler_DriftingAlien_Loop | Jump to Handler_DriftingAlien_Loop. | ||||||
|
When the alien is below the target, apply upward thrust.
|
||||||||
| Handler_DriftingAlien_ThrustUp | 96E8 | LD A,(IX+$06) | Jump to Handler_DriftingAlien_SubtractThrust if the vertical thrust is positive. | |||||
| 96EB | AND A | |||||||
| 96EC | JP P,Handler_DriftingAlien_SubtractThrust | |||||||
| 96EF | CP $D1 | Jump to Handler_DriftingAlien_ApplyThrust if the thrust is already below D1. | ||||||
| 96F1 | JR C,Handler_DriftingAlien_ApplyThrust | |||||||
| Handler_DriftingAlien_SubtractThrust | 96F3 | SUB $02 | Subtract 02 from the thrust. | |||||
| 96F5 | JR Handler_DriftingAlien_ApplyThrust | Jump to Handler_DriftingAlien_ApplyThrust. | ||||||
|
Bounce off the top of the play area.
|
||||||||
| Handler_DriftingAlien_BounceTop | 96F7 | LD A,(IX+$06) | Jump to Handler_DriftingAlien_Animate if the vertical thrust is positive. | |||||
| 96FA | AND A | |||||||
| 96FB | JP P,Handler_DriftingAlien_Animate | |||||||
| Handler_DriftingAlien_NegateThrust | 96FE | NEG | Negate the thrust. | |||||
| 9700 | LD (IX+$06),A | Write it back. | ||||||
| 9703 | JR Handler_DriftingAlien_Animate | Jump to Handler_DriftingAlien_Animate. | ||||||
|
Bounce off the ground line.
|
||||||||
| Handler_DriftingAlien_BounceGround | 9705 | LD A,(IX+$06) | Jump to Handler_DriftingAlien_Animate if the vertical thrust is negative. | |||||
| 9708 | AND A | |||||||
| 9709 | JP M,Handler_DriftingAlien_Animate | |||||||
| 970C | JR Handler_DriftingAlien_NegateThrust | Jump to Handler_DriftingAlien_NegateThrust. | ||||||
| Prev: 95B6 | Up: Map | Next: 970E |