![]() |
Routines |
| Prev: 45770 | Up: Map | Next: 45912 |
|
Moves a creature one step closer to Sabreman's room when it is in a different room x. It does not draw the creature. It is entered with the carry flag set if Sabreman's room x is less than the room x of the creature.
The creature is flagged so that it will be drawn without being erased when it arrives. It accelerates by two on each call in the direction of Sabreman's room, up to a speed of 48 and its x position changes by a sixteenth of the speed. When the x position goes past 208 (or below 24) it moves into the next room.
The y position is kept at 64 or more, and when it is 128 or more it moves up two pixels each time.
A creature cannot leave its room through a wall. If the wall is on the side that it is going to, it is removed when it is in the same room y as Sabreman, and otherwise Move_Creature_Vertically moves it up or down.
|
||||||||||
| Move_Creature_Horizontally | 45775 | LD (IX+15),1 | Set the redraw flags to 1 so that the creature is drawn without being erased when it arrives. | |||||||
| 45779 | LD (IX+11),0 | Clear the contact flags. | ||||||||
| 45783 | JR C,Move_Creature_Horizontally_Move_Left | Jump to Move_Creature_Horizontally_Move_Left if Sabreman is on the left of the creature. | ||||||||
| 45785 | BIT 2,E | Jump to Move_Creature_Horizontally_Blocked if the room has a right wall. | ||||||||
| 45787 | JR NZ,Move_Creature_Horizontally_Blocked | |||||||||
| 45789 | LD A,(IX+8) | Fetch the x velocity. | ||||||||
| 45792 | ADD A,2 | Accelerate to the right by adding two. | ||||||||
| 45794 | BIT 7,A | Jump to Move_Creature_Horizontally_Store_Velocity if the x velocity is negative. | ||||||||
| 45796 | JR NZ,Move_Creature_Horizontally_Store_Velocity | |||||||||
| 45798 | CP 49 | Jump to Move_Creature_Horizontally_Move_Right if the x velocity has reached 49. | ||||||||
| 45800 | JR NC,Move_Creature_Horizontally_Move_Right | |||||||||
| Move_Creature_Horizontally_Store_Velocity | 45802 | LD (IX+8),A | Store the x velocity. | |||||||
| Move_Creature_Horizontally_Move_Right | 45805 | LD A,(IX+8) | Fetch the x velocity. | |||||||
| 45808 | SRA A | Divide it by sixteen, keeping the sign. | ||||||||
| 45810 | SRA A | |||||||||
| 45812 | SRA A | |||||||||
| 45814 | SRA A | |||||||||
| 45816 | ADD A,(IX+1) | Add the x position of the creature. | ||||||||
| 45819 | CP 208 | Jump to Move_Creature_Horizontally_Store_X if the x position is less than 208. | ||||||||
| 45821 | JR C,Move_Creature_Horizontally_Store_X | |||||||||
| 45823 | INC (IX+2) | Move the creature to the room on the right. | ||||||||
| 45826 | LD A,8 | Set the x position to 8. | ||||||||
| Move_Creature_Horizontally_Store_X | 45828 | LD (IX+1),A | Store the x position. | |||||||
|
Keep the y position between 64 and 128 and make it drift upwards when it is 128 or more.
|
||||||||||
| Move_Creature_Horizontally_Adjust_Y | 45831 | LD A,(IX+3) | Fetch the y position. | |||||||
| 45834 | CP 64 | Jump to Move_Creature_Horizontally_Drift_Up if the y position is 64 or more. | ||||||||
| 45836 | JR NC,Move_Creature_Horizontally_Drift_Up | |||||||||
| 45838 | LD (IX+3),64 | Set the y position to 64. | ||||||||
| Move_Creature_Horizontally_Drift_Up | 45842 | CP 128 | Return if the y position is less than 128. | |||||||
| 45844 | RET C | |||||||||
| 45845 | SUB 2 | Subtract two. | ||||||||
| 45847 | LD (IX+3),A | Store the y position. | ||||||||
| 45850 | RET | Return. | ||||||||
|
Sabreman is on the left of the creature.
|
||||||||||
| Move_Creature_Horizontally_Move_Left | 45851 | BIT 6,E | Jump to Move_Creature_Horizontally_Blocked if the room has a left wall. | |||||||
| 45853 | JR NZ,Move_Creature_Horizontally_Blocked | |||||||||
| 45855 | LD A,(IX+8) | Fetch the x velocity. | ||||||||
| 45858 | SUB 2 | Accelerate to the left by subtracting two. | ||||||||
| 45860 | BIT 7,A | Jump to Move_Creature_Horizontally_Store_Left_Velocity if the x velocity is positive. | ||||||||
| 45862 | JR Z,Move_Creature_Horizontally_Store_Left_Velocity | |||||||||
| 45864 | CP 208 | Jump to Move_Creature_Horizontally_Add_Left_Velocity if the x velocity is less than 208. | ||||||||
| 45866 | JR C,Move_Creature_Horizontally_Add_Left_Velocity | |||||||||
| Move_Creature_Horizontally_Store_Left_Velocity | 45868 | LD (IX+8),A | Store the x velocity. | |||||||
| Move_Creature_Horizontally_Add_Left_Velocity | 45871 | LD A,(IX+8) | Fetch the x velocity. | |||||||
| 45874 | SRA A | Divide it by sixteen, keeping the sign. | ||||||||
| 45876 | SRA A | |||||||||
| 45878 | SRA A | |||||||||
| 45880 | SRA A | |||||||||
| 45882 | ADD A,(IX+1) | Add the x position of the creature. | ||||||||
| 45885 | CP 24 | Jump to Move_Creature_Horizontally_Store_Left_X if the x position is 24 or more. | ||||||||
| 45887 | JR NC,Move_Creature_Horizontally_Store_Left_X | |||||||||
| 45889 | DEC (IX+2) | Move the creature to the room on the left. | ||||||||
| 45892 | LD A,223 | Set the x position to 223. | ||||||||
| Move_Creature_Horizontally_Store_Left_X | 45894 | LD (IX+1),A | Store the x position. | |||||||
| 45897 | JR Move_Creature_Horizontally_Adjust_Y | Jump to Move_Creature_Horizontally_Adjust_Y. | ||||||||
|
The creature cannot go that way.
|
||||||||||
| Move_Creature_Horizontally_Blocked | 45899 | LD A,(36638) | Fetch the room y of Sabreman. | |||||||
| 45902 | CP (IX+4) | Jump to Move_Creature_Vertically if the creature is in a different room y. | ||||||||
| 45905 | JR NZ,Move_Creature_Vertically | |||||||||
|
This entry point is used by the routine at Move_Creature_Vertically.
|
||||||||||
| Move_Creature_Horizontally_Remove_Creature | 45907 | LD (IX+0),0 | Remove the creature. | |||||||
| 45911 | RET | Return. | ||||||||
| Prev: 45770 | Up: Map | Next: 45912 |