Difference between revisions of "Normal.motion"

From AGI Wiki
Jump to navigationJump to search
(Created page with "normal.motion   == <br />Syntax == <blockquote><code>normal.motion(oA);</code></blockquote> == <br />Description == Object oA moves normally. That is, if the object ...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
normal.motion
+
The '''normal.motion''' command switches an object's [[movement mode]] to 'normal'.
  
&nbsp;
+
== Syntax ==
  
== <br />Syntax ==
+
normal.motion([[screen object|obj]] oA);
  
<blockquote><code>normal.motion(oA);</code></blockquote>
+
== Remarks ==
  
== <br />Description ==
+
Object '''oA''' is set to 'normal' [[movement mode|motion (movement) mode]]. If already in normal mode, this command has no effect.
  
Object oA moves normally. That is, if the object was wandering or following ego, or it was moving to a location specified by a <code>[[move.obj]]</code> command, it continues in the direction it was traveling, until it is told to stop, move in another direction or runs into an obstacle.
+
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.
  
== <br />Sources ==
+
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.
  
[[AGI Studio Help File]]
+
The '''normal.motion''' command mode does NOT automatically switch [[ego]] to  [[player.control|player control]] mode. The '''[[start.motion]]''' command also sets an object to 'normal' movement mode, but will also switch to player control mode if the object is ego.
  
== <br />See also ==
+
== Possible Errors ==
  
* <code>[[move.obj]]</code>
+
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]].
* [[Moving Objects]]
 
  
&nbsp;
+
== Example ==
  
[[Category:Object Commands]]
+
<div class="CodeBlockHeader">Code:</div>
[[Category:View Commands]]
+
<syntaxhighlight lang="agi">
[[Category:References]]
+
wander(o1);        [ object wanders aimlessly
[[Category:Logic]]
+
...
 +
normal.motion(o1); [ normal motion restored
 +
</syntaxhighlight>
 +
 
 +
== Technical Information ==
 +
 
 +
{| border="1" cellpadding="2"
 +
| style="background-color: #efefef" width="200" | '''Required Interpreter Version:'''
 +
| width="175" | Available in all AGI versions.
 +
|-
 +
| style="background-color: #efefef" | '''Byte-Code Value:'''
 +
| 85 (0x55 hex)
 +
|}
 +
 
 +
== See Also ==
 +
 
 +
'''[[move.obj]]'''<br />
 +
'''[[move.obj.v]]'''<br />
 +
'''[[set.dir]]'''<br />
 +
'''[[wander]]'''<br />
 +
[[Moving Objects]]<br />
 +
[[Category:Commands]]<br />

Latest revision as of 17:49, 23 April 2019

The normal.motion command switches an object's movement mode to 'normal'.

Syntax

normal.motion(obj oA);

Remarks

Object oA is set to 'normal' motion (movement) mode. If already in normal mode, this command has no effect.

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.

The normal.motion command mode does NOT automatically switch ego to player control mode. The start.motion command also sets an object to 'normal' movement mode, but will also switch to player control mode if the object is ego.

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:
wander(o1);        [ object wanders aimlessly
...
normal.motion(o1); [ normal motion restored

Technical Information

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

See Also

move.obj
move.obj.v
set.dir
wander
Moving Objects