Prev: 53371 Up: Map Next: 53420
53381: Steer Towards Target
Used by the routines at RunPentagramStone and RunHelper.
Sets the speeds of an object along x and y to one in the direction that takes it towards a target, or to nothing if it is already in line with the target on an axis. The target is held at 21 and 22 of the record.
Input
IX Object record
Set the speed along x towards the target.
SteerTowardsTarget 53381 LD A,(IX+1) Fetch the x position of the object.
53384 CP (IX+21) Jump to SteerTowardsTarget_Y if it is the same as the target.
53387 JR Z,SteerTowardsTarget_Y
53389 JR C,SteerTowardsTarget_X Jump to SteerTowardsTarget_X if it is lower.
53391 LD (IX+9),255 Set the speed along x to 255.
53395 JR SteerTowardsTarget_Y Jump to SteerTowardsTarget_Y.
SteerTowardsTarget_X 53397 LD (IX+9),1 Set the speed along x to 1.
Set the speed along y towards the target.
SteerTowardsTarget_Y 53401 LD A,(IX+2) Fetch the y position of the object.
53404 CP (IX+22) Return if it is the same as the target.
53407 RET Z
53408 JR C,SteerTowardsTarget_UpY Jump to SteerTowardsTarget_UpY if it is lower.
53410 LD (IX+10),255 Set the speed along y to 255.
53414 RET Return.
SteerTowardsTarget_UpY 53415 LD (IX+10),1 Set the speed along y to 1.
53419 RET Return.
Prev: 53371 Up: Map Next: 53420