Difference between revisions of "Step.size"

From AGI Wiki
Jump to navigationJump to search
(Created page with "step.size   == <br />Syntax == <blockquote><code>step.size(oA,vB);</code></blockquote> == <br />Description == The step size of oA (the number of pixels it moves eac...")
 
 
Line 1: Line 1:
step.size
+
The '''step.size''' command sets the number of pixels that an object moves each step.
  
&nbsp;
+
== Syntax ==
  
== <br />Syntax ==
+
step.size([[screen object|obj]] oA, [[variable|var]] vB);
  
<blockquote><code>step.size(oA,vB);</code></blockquote>
+
== Remarks ==
  
== <br />Description ==
+
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]].
  
The step size of oA (the number of pixels it moves each step) is set to vB.
+
Setting the [[step size]] to zero will prevent the object from moving at all.
  
== <br />Sources ==
+
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.
  
[[AGI Studio Help File]]
+
== Possible Errors ==
  
== <br />See also ==
+
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]].
  
* <code>[[step.time]]</code>
+
== Example ==
* <code>[[move.obj]]</code>
 
* <code>[[move.obj.v]]</code>
 
* <code>[[follow.ego]]</code>
 
* [[Moving Objects]]
 
  
&nbsp;
+
<div class="CodeBlockHeader">Code:</div>
 +
<syntaxhighlight lang="agi">
 +
#define giraffe o3
 +
...  [ initialize the object
 +
step.size(giraffe, 3); [ giraffes have long legs!
 +
</syntaxhighlight>
  
[[Category:Object Commands]]
+
== Technical Information ==
[[Category:View Commands]]
+
 
[[Category:References]]
+
{| border="1" cellpadding="2"
[[Category:Logic]]
+
| style="background-color: #efefef" width="200" | '''Required Interpreter Version:'''
 +
| width="175" | Available in all AGI versions.
 +
|-
 +
| style="background-color: #efefef" | '''Byte-Code Value:'''
 +
| 79 (0x4F hex)
 +
|}
 +
 
 +
== See Also ==
 +
 
 +
'''[[step.time]]'''<br />
 +
'''[[cycle.time]]'''<br />
 +
[[Category:Commands]]<br />

Latest revision as of 19:23, 23 April 2019

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