Prev: E00B Up: Map Next: E020
E013: Test Cell Moving Right
Used by the routine at TestMoveRight.
Tests an object that is moving to the right (along the positive X axis) against the walls in one cell. If the object hits a wall then its velocity along the X axis is reduced by twice the depth that it has gone into the wall, and the flag for a collision is set.
Input
DE X position to test
HL Y position to test
IX Object
Output
F The carry flag is set if there was a collision
Check the walls, then push the object back if it is touching one.
TestCellMovingRight E013 CALL CheckWallsVerticalFirst Check whether the object hits a wall in the cell.
E016 RET NC Return if it did not.
This entry point is used by the routine at TestCellMovingLeft.
Reduce the velocity along the X axis.
ReduceVelocityX E017 ADD A,A Double the depth.
E018 ADD A,(IX+$0A) Add it to the velocity along the X axis, which stops the object at the wall.
E01B LD (IX+$0A),A
E01E JR SetCollisionFlag Jump to SetCollisionFlag to set the flag for a collision.
Prev: E00B Up: Map Next: E020