![]() |
Routines |
| Prev: 9906 | Up: Map | Next: 9994 |
|
Steer the Bouncing Wheel toward the scroll position and bounce it at the play-area edges.
|
||||||||
| Handler_BouncingWheel | 993C | LD H,(IX+$03) | Fetch the high byte of the world X. | |||||
| 993F | LD L,(IX+$02) | Fetch the low byte of the world X. | ||||||
| 9942 | LD DE,($607A) | Fetch Jetman_Position. | ||||||
| 9946 | AND A | Subtract the scroll position. | ||||||
| 9947 | SBC HL,DE | |||||||
| 9949 | LD C,$00 | C=00. | ||||||
|
Leave the speed unchanged if the wheel is on this screen or just off its left edge.
|
||||||||
| 994B | LD A,H | Fetch the high byte of the gap. | ||||||
| 994C | AND %00011111 | Keep only bits 0-4. | ||||||
| 994E | JR Z,Handler_BouncingWheel_AddY | Jump to Handler_BouncingWheel_AddY if the alien is on this screen. | ||||||
| 9950 | OR %11100000 | Set bits 5-7. | ||||||
| 9952 | CPL | Flip the bits. | ||||||
| 9953 | AND A | Jump to Handler_BouncingWheel_AddY if the result is zero. | ||||||
| 9954 | JR Z,Handler_BouncingWheel_AddY | |||||||
| 9956 | BIT 4,H | Test bit 4 of the gap. | ||||||
|
30 is a signed +30 rightward speed; D0 is signed -30 leftward.
|
||||||||
| 9958 | LD A,$30 | A=30. | ||||||
| 995A | JR NZ,Handler_BouncingWheel_WriteSpeed | Jump to Handler_BouncingWheel_WriteSpeed if the alien is left of the scroll. | ||||||
| 995C | LD A,$D0 | A=D0. | ||||||
| Handler_BouncingWheel_WriteSpeed | 995E | LD (IX+$05),A | Write the speed to *IX+05. | |||||
|
Move the wheel vertically, bouncing it off the play-area edges.
|
||||||||
| Handler_BouncingWheel_AddY | 9961 | LD A,(IX+$04) | Fetch the alien's Y position. | |||||
| 9964 | ADD A,(IX+$06) | Add the vertical thrust. | ||||||
| 9967 | CP $38 | Jump to Handler_BouncingWheel_ThrustDown if the alien is above the play area. | ||||||
| 9969 | JR C,Handler_BouncingWheel_ThrustDown | |||||||
| 996B | CP $B0 | Jump to Handler_BouncingWheel_ThrustUp if the alien has hit the ground line. | ||||||
| 996D | JR NC,Handler_BouncingWheel_ThrustUp | |||||||
| 996F | LD (IX+$04),A | Write the Y position back. | ||||||
|
Step the animation timer and pick the animation frame.
|
||||||||
| Handler_BouncingWheel_TickAnimation | 9972 | INC (IX+$11) | Increase the animation timer. | |||||
| 9975 | LD A,(IX+$11) | Fetch the animation timer. | ||||||
| 9978 | CP $06 | Jump to Handler_BouncingWheel_WriteFrame if it is still below 06. | ||||||
| 997A | JR C,Handler_BouncingWheel_WriteFrame | |||||||
| 997C | XOR A | Write 00 to the animation timer. | ||||||
| 997D | LD (IX+$11),A | |||||||
|
Sprite IDs begin at A8 ("Bouncing Wheel: Frame 1").
|
||||||||
| Handler_BouncingWheel_WriteFrame | 9980 | ADD A,$A8 | Add A8 for these frames. | |||||
| 9982 | LD (IX+$00),A | Write it to the actor type. | ||||||
| 9985 | JP PlaceSpawnedAlien_Age | Jump to PlaceSpawnedAlien_Age. | ||||||
|
Bounce off the top by thrusting down, or off the ground by thrusting up.
|
||||||||
| Handler_BouncingWheel_ThrustDown | 9988 | LD (IX+$06),$03 | Write 03 to the vertical thrust. | |||||
| 998C | JR Handler_BouncingWheel_TickAnimation | Jump to Handler_BouncingWheel_TickAnimation. | ||||||
| Handler_BouncingWheel_ThrustUp | 998E | LD (IX+$06),$FD | Write FD to the vertical thrust. | |||||
| 9992 | JR Handler_BouncingWheel_TickAnimation | Jump to Handler_BouncingWheel_TickAnimation. | ||||||
| Prev: 9906 | Up: Map | Next: 9994 |