![]() |
Routines |
| Prev: 57443 | Up: Map | Next: 57504 |
|
Used by the routines at CheckWallsVerticalFirst and CheckWallsHorizontalFirst.
Checks whether an object overlaps a rectangle along the X axis, using the position that the velocity takes the object to.
|
||||||||||||||||||
|
Find the sum of the half widths.
|
||||||||||||||||||
| CheckOverlapAlongX | 57479 | LD A,(IX+8) | Work out the combined half widths of the object and the rectangle. | |||||||||||||||
| 57482 | SRL A | |||||||||||||||||
| 57484 | ADD A,(IY+2) | |||||||||||||||||
| 57487 | LD C,A | |||||||||||||||||
|
Find the distance between the middles.
|
||||||||||||||||||
| 57488 | LD A,(IX+10) | Fetch the velocity along x. | ||||||||||||||||
| 57491 | SRA A | Add half of it to the position, then find the distance from the middle of the rectangle. | ||||||||||||||||
| 57493 | ADD A,E | |||||||||||||||||
| 57494 | SUB (IY+0) | |||||||||||||||||
|
Make the distance positive, then subtract the sum.
|
||||||||||||||||||
| 57497 | JP P,CheckOverlapAlongX_Depth | Make the distance positive. | ||||||||||||||||
| 57500 | NEG | |||||||||||||||||
|
Subtract the combined half widths and return.
|
||||||||||||||||||
| CheckOverlapAlongX_Depth | 57502 | SUB C | Subtract the sum. | |||||||||||||||
| 57503 | RET | Return. | ||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||
| Prev: 57443 | Up: Map | Next: 57504 |