Prev: DF97 Up: Map Next: E00B
DFFA: Test Cell Moving Up
Used by the routine at TestMoveUp.
Tests an object that is moving up the screen (along the positive Y axis) against the walls in one cell. If the object hits a wall then its velocity along the Y 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.
TestCellMovingUp DFFA CALL CheckWallsHorizontalFirst Check whether the object hits a wall in the cell.
DFFD RET NC Return if it did not.
This entry point is used by the routine at TestCellMovingDown.
Reduce the velocity along the Y axis.
ReduceVelocityY DFFE ADD A,A Double the depth.
DFFF ADD A,(IX+$0B) Add it to the velocity along the Y axis, which stops the object at the wall.
E002 LD (IX+$0B),A
This entry point is used by the routine at TestCellMovingRight.
Set the flag for a collision.
SetCollisionFlag E005 SET 0,(IX+$07) Set the flag for a collision.
E009 SCF Set the carry flag and return.
E00A RET
Prev: DF97 Up: Map Next: E00B