Follow.ego

From AGI Wiki
Jump to navigationJump to search

follow.ego

The follow.ego command sets an object's motion style to move toward the ego object (o0). [edit] Syntax

follow.ego(obj oA, byt STEP, flg fDONE);

Remarks

Object oA begins moving toward ego. The interpreter calculates the best direction based on distance from ego, and any obstacles it encounters.

Flag fDONE is reset when the command is executed.

The object will move STEP pixels each step (or it will move at its current step size, if STEP is less than the object's step size).

When it is within STEP pixels of ego's position, the object will stop moving, flag fDONE is set, and the object switches to normal motion style.

The set.dir command does not work when an object's motion is set to follow ego.

You can use the follow.ego command on the ego object itself, but it will instantaneously reach its destination on the next cycle, and switch back to normal motion style.

Example

follow.ego(o1, 1, f99); //object will begin moving toward ego

Required Interpreter Version

Available in all AGI versions.

Bytecode Value

0x53

See Also