Difference between revisions of "Normal.motion"

From AGI Wiki
Jump to navigationJump to search
Line 17: Line 17:
 
== Possible Errors ==
 
== Possible Errors ==
  
AGI does not check that object number '''oA''' is a valid object. If it is not, this command will overwrite other data on the [[memory heap]], which may cause unexpected results, including possibly [[crashing AGI]].
+
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 ==
 
== Example ==

Revision as of 18:30, 12 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.

Setting ego to 'normal' motion mode will NOT restore player control. You must use the player.control command.

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