![]() |
Routines |
| Prev: 6E11 | Up: Map | Next: 6EA8 |
|
Used by the routine at HandleHitActor.
Moves an actor which has been hit by a flour shot (see TestFlourCollision). The actor moves by the speeds in bytes 04 and 05 which were taken from the flour shot. Byte 07 of the actor is a counter which was set to 40; each time this is called it is decreased, and when it reaches zero the actor recovers (see RecoverHitActor). The speed is changed to 04 (or FC) when the actor reaches the left (or right) edge of the play area or the top of it, and if the other speed is zero it is changed to a random one. When the actor reaches the bottom of the play area then LandHitActor deals with it.
Two bits of byte 06 of the actor are changed; bit 1 is set if the actor is less than 34 pixels from the middle of the screen (68), and bit 7 is set if the actor is moving towards the middle of the screen (which is when it is in the left half and moving right, or in the right half and moving left).
|
||||||||
| MoveHitActor | 6E25 | DEC (IX+$07) | Decrease the counter in byte 07 of the actor by one. | |||||
| 6E28 | JR Z,RecoverHitActor | Jump to RecoverHitActor if the counter is zero. | ||||||
| 6E2A | LD A,(IX+$01) | Fetch the horizontal co-ordinate. | ||||||
| 6E2D | ADD A,(IX+$04) | Add the horizontal speed. | ||||||
| 6E30 | CP $04 | Jump to MoveHitActor_LeftEdge if the actor has reached the left edge. | ||||||
| 6E32 | JR C,MoveHitActor_LeftEdge | |||||||
| 6E34 | CP $C4 | Jump to MoveHitActor_RightEdge if the actor has reached the right edge. | ||||||
| 6E36 | JR NC,MoveHitActor_RightEdge | |||||||
| 6E38 | LD (IX+$01),A | Update the horizontal co-ordinate. | ||||||
| MoveHitActor_Vertical | 6E3B | LD A,(IX+$02) | Fetch the vertical co-ordinate. | |||||
| 6E3E | ADD A,(IX+$05) | Add the vertical speed. | ||||||
| 6E41 | CP $20 | Jump to MoveHitActor_Top if the actor has reached the top. | ||||||
| 6E43 | JR C,MoveHitActor_Top | |||||||
| 6E45 | CP $A0 | Jump to LandHitActor if the actor has reached the bottom. | ||||||
| 6E47 | JR NC,LandHitActor | |||||||
| 6E49 | LD (IX+$02),A | Update the vertical co-ordinate. | ||||||
|
Work out which half of the screen the actor is in, and how far it is from the middle.
|
||||||||
| 6E4C | LD A,(IX+$01) | Fetch the horizontal co-ordinate. | ||||||
| 6E4F | SUB $68 | Subtract 68 (the middle of the screen). | ||||||
| 6E51 | JP P,MoveHitActor_RightHalf | Jump to MoveHitActor_RightHalf if the actor is in the right half. | ||||||
| 6E54 | SET 7,(IX+$06) | Set bit 7 of byte 06 of the actor. | ||||||
| 6E58 | NEG | Make the distance positive. | ||||||
| 6E5A | JR MoveHitActor_Distance | Jump to MoveHitActor_Distance. | ||||||
| MoveHitActor_RightHalf | 6E5C | RES 7,(IX+$06) | Reset bit 7 of byte 06 of the actor. | |||||
| MoveHitActor_Distance | 6E60 | CP $34 | Jump to MoveHitActor_Far if the actor is 34 pixels or more from the middle. | |||||
| 6E62 | JR NC,MoveHitActor_Far | |||||||
| 6E64 | SET 1,(IX+$06) | Set bit 1 of byte 06 of the actor. | ||||||
| 6E68 | JR MoveHitActor_Direction | Jump to MoveHitActor_Direction. | ||||||
| MoveHitActor_Far | 6E6A | RES 1,(IX+$06) | Reset bit 1 of byte 06 of the actor. | |||||
|
Make bit 7 of byte 06 of the actor show whether the actor is moving towards the middle, by combining it with the direction of the horizontal speed.
|
||||||||
| MoveHitActor_Direction | 6E6E | LD A,(IX+$04) | Fetch the horizontal speed. | |||||
| 6E71 | AND %10000000 | Keep only bit 7. | ||||||
| 6E73 | XOR (IX+$06) | Combine with byte 06 of the actor. | ||||||
| 6E76 | LD (IX+$06),A | Update byte 06 of the actor with the result. | ||||||
| 6E79 | RET | Return. | ||||||
|
The actor has reached the left edge, so make it move to the right.
|
||||||||
| MoveHitActor_LeftEdge | 6E7A | LD (IX+$04),$04 | Set the horizontal speed to 04 (moving right). | |||||
| MoveHitActor_TestVerticalSpeed | 6E7E | LD A,(IX+$05) | Fetch the vertical speed. | |||||
| 6E81 | AND A | Is the vertical speed zero? | ||||||
| 6E82 | JR NZ,MoveHitActor_Vertical | Jump to MoveHitActor_Vertical if it is not. | ||||||
| 6E84 | LD A,R | Fetch a random number. | ||||||
| 6E86 | AND %00000100 | Keep only bit 2. | ||||||
| 6E88 | SUB $02 | Subtract 02 so that the speed is FE or 02. | ||||||
| 6E8A | LD (IX+$05),A | Update the vertical speed. | ||||||
| 6E8D | JR MoveHitActor_Vertical | Jump to MoveHitActor_Vertical. | ||||||
|
The actor has reached the right edge, so make it move to the left.
|
||||||||
| MoveHitActor_RightEdge | 6E8F | LD (IX+$04),$FC | Set the horizontal speed to FC (moving left). | |||||
| 6E93 | JR MoveHitActor_TestVerticalSpeed | Jump to MoveHitActor_TestVerticalSpeed. | ||||||
|
The actor has reached the top, so make it move down.
|
||||||||
| MoveHitActor_Top | 6E95 | LD (IX+$05),$04 | Set the vertical speed to 04 (moving down). | |||||
|
This entry point is used by the routine at LandHitActor.
|
||||||||
| MoveHitActor_TestHorizontalSpeed | 6E99 | LD A,(IX+$04) | Fetch the horizontal speed. | |||||
| 6E9C | AND A | Is the horizontal speed zero? | ||||||
| 6E9D | RET NZ | Return if it is not. | ||||||
| 6E9E | LD A,R | Fetch a random number. | ||||||
| 6EA0 | AND %00000100 | Keep only bit 2. | ||||||
| 6EA2 | SUB $02 | Subtract 02 so that the speed is FE or 02. | ||||||
| 6EA4 | LD (IX+$04),A | Update the horizontal speed. | ||||||
| 6EA7 | RET | Return. | ||||||
| Prev: 6E11 | Up: Map | Next: 6EA8 |