The move.obj command sets an object's movement mode to 'move object', meaning it will move toward a specified screen coordinate.
Screen object oA begins moving toward the point (X, Y). AGI calculates the best direction based on distance from the point. The screen object will move STEP pixels each step. If STEP is zero, the screen object's current step size is used. When the screen object is less than STEP pixels away from point (X, Y), the screen object's direction is set to 0, flag fDONE is set to TRUE, and the screen object switches to normal motion. The screen object's original step size is restored.
Flag fDONE is reset to FALSE when the command is executed.
If you use the set.dir command when a screen object's motion is set to move to a point, the screen object will move in that direction for one interpreter cycle, but will begin moving toward the end point again after that.
AGI does not check that screen object number oA is a valid screen object. If it is not, this command will overwrite other data on the memory heap, which may cause unexpected results, including possibly crashing AGI.
If either X or Y are off screen (X >= 160; Y >= 168), the command behaves a bit differently. As soon as the screen object reaches an edge, AGI will set flag fDONE to TRUE, and switch the screen object to normal motion, but the screen object's direction is not set to zero. If the screen object was moving diagonally when it touched the edge, it will continue moving along the edge since its direction was not set to zero. To avoid unintentional results, it is best to avoid using invalid values for X and Y.
WARNING: If your game relies on the flag fDONE to be set before continuing with something, such as going to the next part of a cut scene, make sure that the screen object will always be able to reach its destination. It is possible that it could get caught behind a barrier or something, and not be able to get where it needs to go, in which case the game will sit there forever doing nothing. This is more of a problem when the screen object being moved is ego - it might work fine from where you test it, but it may be possible for the player to move ego into such a position where they will get “stuck” when being moved.
move.obj(o1, 120, 44, 2, f99); [ object will move to the point (120, 44), [ two pixels per step
|Required Interpreter Version:||Available in all AGI versions.|
|Byte-Code Value:||81 (0x51 hex)|