Difference between revisions of "Start.motion"

From AGI Wiki
Jump to navigationJump to search
(Created page with "start.motion   == <br />Syntax == <blockquote><code>start.motion(oA);</code></blockquote> == <br />Description == I am not quite sure what this command does. The nam...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
start.motion
+
The '''start.motion''' command sets a screen object's movement mode to 'normal', and if the object is ego, also sets the ego to player control mode.
  
&nbsp;
+
== Syntax ==
  
== <br />Syntax ==
+
start.motion([[screen object|obj]] oA);
  
<blockquote><code>start.motion(oA);</code></blockquote>
+
== Remarks ==
  
== <br />Description ==
+
This command sets [[screen object]] '''oA''' to 'normal' [[movement mode]]. If the screen object is the [[ego]] object (o0) it also switches to [[player.control|player control]] mode.
  
I am not quite sure what this command does. The name implies that object oA starts to move, but this does not seem to work (instead you have to use <code>[[set.dir]]</code> to set the direction of the object to something other than 0).
+
While in normal motion mode, an object will not move until it is given a direction via the '''[[set.dir]]''' command. It will continue moving until it reaches an obstacle, the edge of the screen, a new direction via command, or is stopped using the '''[[stop.motion]]''' command.
  
If oA is ego (object 0), the <code>[[player.control]]</code> command is issued by the interpreter.
+
Unlike the other movement modes, changing to 'normal' does not modify the [[updating property]]. The [[cycling property]] is also not modified by the '''normal.motion''' command.
  
== <br />Sources ==
+
This command is identical to the '''[[normal.motion]]''' command, except that it also switches [[ego]] to [[player.control|player control]] mode. The '''[[normal.motion]]''' does not automatically switch ego control mode.
  
[[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>[[stop.motion]]</code>
+
== Example ==
* <code>[[set.dir]]</code>
 
* <code>[[player.control]]</code>
 
* [[Moving Objects]]
 
  
&nbsp;
+
<div class="CodeBlockHeader">Code:</div>
 +
<syntaxhighlight lang="agi">
 +
stop.motion(ego); [ ego stops moving, and switches to program control
 +
start.motion(ego);
 +
[ equivalent code
 +
normal.motion(ego);
 +
player.control();
 +
...
 +
[ for non-ego objects these two lines do EXACTLY the same thing
 +
start.motion(o1);
 +
normal.motion(o1);
 +
</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:'''
 +
| 78 (0x4E hex)
 +
|}
 +
 
 +
== See Also ==
 +
 
 +
'''[[normal.motion]]'''<br />
 +
'''[[player.control]]'''<br />
 +
'''[[stop.motion]]'''<br />
 +
[[Category:Commands]]<br />

Latest revision as of 17:24, 23 April 2019

The start.motion command sets a screen object's movement mode to 'normal', and if the object is ego, also sets the ego to player control mode.

Syntax

start.motion(obj oA);

Remarks

This command sets screen object oA to 'normal' movement mode. If the screen object is the ego object (o0) it also switches to player control mode.

While in normal motion mode, an object will not move until it is given a direction via the set.dir command. It will continue moving until it reaches an obstacle, the edge of the screen, a new direction via command, or is stopped using the stop.motion command.

Unlike the other movement modes, changing to 'normal' does not modify the updating property. The cycling property is also not modified by the normal.motion command.

This command is identical to the normal.motion command, except that it also switches ego to player control mode. The normal.motion does not automatically switch ego control mode.

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"> stop.motion(ego); [ ego stops moving, and switches to program control start.motion(ego); [ equivalent code normal.motion(ego); player.control(); ... [ for non-ego objects these two lines do EXACTLY the same thing start.motion(o1); normal.motion(o1); </syntaxhighlight>

Technical Information

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

See Also

normal.motion
player.control
stop.motion