Difference between revisions of "Position"
(Created page with "The '''position''' command sets the position of a screen object that is not on screen. == Syntax == position(obj oA, byt X, byt Y);...") |
m (→Remarks) |
||
Line 9: | Line 9: | ||
The position on the screen of [[screen object]] '''oA''' is set to ('''X''', '''Y'''). If either value results in the object being off screen ('''X''' + object width > 159, '''Y''' > 167 or '''Y''' - object height < 0), AGI will use the [[shuffle]] function to place the object on the screen when the '''[[draw]]''' command is used. | The position on the screen of [[screen object]] '''oA''' is set to ('''X''', '''Y'''). If either value results in the object being off screen ('''X''' + object width > 159, '''Y''' > 167 or '''Y''' - object height < 0), AGI will use the [[shuffle]] function to place the object on the screen when the '''[[draw]]''' command is used. | ||
− | The '''position''' command should only be used if the object is not on screen (either it has not been [[draw|drawn]] yet, or is currently [[erase|erased]]). If the '''position''' command is executed on an already drawn (visible) [[screen object]], AGI will not erase the image of object at the old location. The object will appear to be in two places, until the original location gets updated by another object passing over it, which then erases the original object image. | + | The '''position''' command should only be used if the object is not on screen (either it has not been [[draw|drawn]] yet, or is currently [[erase|erased]]). If the '''position''' command is executed on an already drawn (visible) [[screen object]], AGI will not erase the image of the object at the old location. The object will appear to be in two places, until the original location gets updated by another object passing over it, which then erases the original object image. |
To change the position of an object that is already on screen, use the '''[[reposition]]''', '''[[reposition.to]]''' and '''[[reposition.to.v]]''' commands. | To change the position of an object that is already on screen, use the '''[[reposition]]''', '''[[reposition.to]]''' and '''[[reposition.to.v]]''' commands. |
Latest revision as of 17:58, 17 April 2019
The position command sets the position of a screen object that is not on screen.
Syntax
position(obj oA, byt X, byt Y);
Remarks
The position on the screen of screen object oA is set to (X, Y). If either value results in the object being off screen (X + object width > 159, Y > 167 or Y - object height < 0), AGI will use the shuffle function to place the object on the screen when the draw command is used.
The position command should only be used if the object is not on screen (either it has not been drawn yet, or is currently erased). If the position command is executed on an already drawn (visible) screen object, AGI will not erase the image of the object at the old location. The object will appear to be in two places, until the original location gets updated by another object passing over it, which then erases the original object image.
To change the position of an object that is already on screen, use the reposition, reposition.to and reposition.to.v commands.
Possible Errors
AGI does not check that object number oA is a valid object. If it is not, this command will overwrite other data on the memory heap, which may cause unexpected results, including possibly crashing AGI.
Example
<syntaxhighlight lang="agi">
- define ogre o3
animate.obj(ogre); load.view(34); set.view(ogre, 34); position(ogre, 152, 71); [ start in cave doorway draw(ogre); </syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in all AGI versions. |
Byte-Code Value: | 37 (0x25 hex) |