Step.size

From AGI Wiki
Revision as of 19:23, 23 April 2019 by Andrew Korson (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The step.size command sets the number of pixels that an object moves each step.

Syntax

step.size(obj oA, var vB);

Remarks

The step size of screen object oA is set to the value of variable vB. The step size of an object determines how far it moves during each step, according to its assigned movement mode.

Setting the step size to zero will prevent the object from moving at all.

Do not confuse step size with step time or cycle time. Step time determines how often the object takes a step, and cycle time determines how often the object's cel changes; these parameters can be set independent of step time.

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 giraffe o3

... [ initialize the object step.size(giraffe, 3); [ giraffes have long legs! </syntaxhighlight>

Technical Information

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

See Also

step.time
cycle.time