Position.v

From AGI Wiki
Revision as of 18:56, 17 April 2019 by Andrew Korson (talk | contribs) (Created page with "The '''position.v''' command indirectly sets the position of a screen object that is not on screen. == Syntax == position.v(obj oA, var vX, ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The position.v command indirectly sets the position of a screen object that is not on screen.

Syntax

position.v(obj oA, var vX, var vY);

Remarks

The position on the screen of screen object oA is changed to (vX, vY). If either value results in the object being off screen (vX + object width > 159. vY > 167, or vY - object height < 0), AGI will use the shuffle function to place the object on the screen when the draw command is used.

The position.v 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.v 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.

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 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.

Example

Code:

<syntaxhighlight lang="agi">

  1. define ogre 03

animate.obj(ogre); load.view(34); set.view(ogre, 34); v201 = 152; v202 = 71; position.v(ogre, v201, v202); [ start in cave doorway draw(ogre); </syntaxhighlight>

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 38 (0x26 hex)

See Also

position
reposition
reposition.to
reposition.to.v