![]() |
Routines |
| Prev: 56433 | Up: Map | Next: 56488 |
|
Slows the player down when no control is used to move. The distance to the next position that is a multiple of eight units is found, and the speed is the distance (up to four units).
|
||||||||
|
Heading zero.
|
||||||||
| SlowPlayerDown | 56441 | LD A,(IX+3) | Fetch the Y position of the player (moving up the screen). | |||||
|
Find the distance to the next multiple of eight.
|
||||||||
| SlowPlayerDown_Distance | 56444 | AND %00000111 | Keep the lowest three bits. | |||||
| 56446 | JR Z,SlowPlayerDown_Stop | Jump to SlowPlayerDown_Stop if the position is a multiple of eight. | ||||||
| 56448 | NEG | Work out the distance to the next multiple of eight units. | ||||||
| 56450 | ADD A,8 | |||||||
| 56452 | LD C,4 | Set a speed of four. | ||||||
| 56454 | CP C | Jump to SlowPlayerDown_Speed if the distance is four or more. | ||||||
| 56455 | JR NC,SlowPlayerDown_Speed | |||||||
|
Halve the greatest speed, and jump to SlowPlayerDown_Speed if the distance is two or more.
|
||||||||
| 56457 | SRL C | Halve the speed. | ||||||
| 56459 | CP C | Jump to SlowPlayerDown_Speed if the distance is two or more. | ||||||
| 56460 | JR NC,SlowPlayerDown_Speed | |||||||
| 56462 | LD C,A | Use the distance. | ||||||
|
Move the player at this speed.
|
||||||||
| SlowPlayerDown_Speed | 56463 | LD A,C | Set the speed and move the player. | |||||
| 56464 | JR MovePlayer_Speed | |||||||
|
Heading one.
|
||||||||
| SlowPlayerDown_Right | 56466 | LD A,(IX+1) | Fetch the X position of the player (moving right). | |||||
| 56469 | JR SlowPlayerDown_Distance | Jump to SlowPlayerDown_Distance. | ||||||
|
Heading two.
|
||||||||
| SlowPlayerDown_Down | 56471 | LD A,(IX+3) | Fetch the Y position of the player (moving down the screen). | |||||
|
Heading two or three.
|
||||||||
| SlowPlayerDown_Negate | 56474 | NEG | Make it negative. | |||||
| 56476 | JR SlowPlayerDown_Distance | Jump to SlowPlayerDown_Distance. | ||||||
|
Heading three.
|
||||||||
| SlowPlayerDown_Left | 56478 | LD A,(IX+1) | Fetch the X position of the player (moving left). | |||||
| 56481 | JR SlowPlayerDown_Negate | Jump to SlowPlayerDown_Negate. | ||||||
|
The player is at a multiple of eight, so the player stops.
|
||||||||
| SlowPlayerDown_Stop | 56483 | LD (IX+5),0 | Set the speed of the player to zero and return. | |||||
| 56487 | RET | |||||||
|
View the equivalent code in;
|
||||||||
| Prev: 56433 | Up: Map | Next: 56488 |