AGI Command Reference - Object Motion Control Commands

From AGI Wiki
Revision as of 21:01, 25 December 2013 by Andrew Branscom (talk | contribs)
Jump to navigationJump to search

Tutorials Table of Contents
AGI Command Reference Index

Page: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16


Object Motion Control Commands
By Chris Cromer

 

The following commands can be given to the object included in the interpreter control list with animate_obj:


set.horizon(n);

Set the horizon to y = n.

ignore.horizon(n);

Object n moves regardless of the horizon position.

observe.horizon(n);

Object n cannot move above the horizon.

block(x1, y1, x2, y2);

Sets a rectangular area (block).

(x1, y1)
   ------------------
   |                |
   |                |
   |                |
   ------------------
                  (x2, y2)

unblock();

Cancels previously set block.

ignore.blocks(n);

Object n moves ignoring conditional barriers (pixels with priority 1) and a block set with a block command.

observe.blocks(n);

Object n may not cross conditional barriers or leave the block.

ignore.objs(n);

Object n moves regardless of positions of other objects.

observe.objs(n);

Object n treats other objects as obstacles.

player.control();

The player is allowed to control EGO (object number 0) using the keyboard or the joystick.

program.control();

The player is not allowed to control object 0 (EGO).

stop.motion(n);

Motion of object n is stopped. If n = 0, program_control is automatically executed.

start.motion(n);

Motion of object n is started. If n = 0 (EGO), player_control automatically executed.

step.size(n, m);

Var(n) determines the number of pixels the object n moves each step.

step.time(n, m);

Var(n) determines the speed of object n motion: delay in the interpreter cycles between consecutive steps. If Var(m) = 1, step occurs on every cycle.

move.obj(n, x, y, s, m); move.obj.v(n, x, y, s, m);

Object n is told to move to the point x,y (or Var(x), Var(y)) by s pixels every step. When the destination is reached, Flag(m) is set to 1. If n = 0 (EGO), program_control is executed automatically.

follow.ego(n, s, m);

Object n is told to chase object 0 (EGO) by s pixels every step. When EGO's and the object's coordinates become equal, Flag(m) is set to 1.

wander(n);

Object n randomly changes the direction of its motion (wanders). If n = 0 (EGO), program_control is issued automatically.

normal.motion(n);

Special object motion mode is canceled. The object continues to move in the direction it was moving in at the time the command was issued.

set.dir(n, m);

Object n is told to move in the direction Var(m)

                      1
                8     |     2
                  \   |   /
                    \ | /
              7 ------------- 3    0 - stop
                    / | \
                  /   |   \
                6     |     4
                      5

get.dir(n, m);

Direction of object n motion is stored in Var(m).

object.on.water(n);

Object n is allowed to be only in the area where its base line is completely on pixels with priority 3 (water surface).

object.on.land(n);

Object n is not allowed to touch pixels of water surface (priority 3).

object.on.anything(n);

Motion restrictions previously set on the object n with commands object_on_water or object_on_land are cancelled.

reposition(n, dx, dy);

Object n jumps from its current location into the location with coordinates x + Var(dx), y + Var(dy).


Notes:
Shouldn't there be reposition and reposition.v?

There should be, but they don't exist.

reposition.to(n, x, y); reposition.to.v(n, x, y);

Similar to the preceding command, but the object is moved to the point x, y (Var(x),Var(y)).

stop.update(n);

Object n is removed from the list of objects updated by the interpreter on each step. The object stays on the screen unchanged.

start.update(n);

Object n is redrawn on each interpreter step.

force.update(n);

Object n is redrawn immediately, without waiting for the end of the interpreter cycle.

distance(n, m, d);

If both objects n and m are on the screen, then

Var(d) = ABS(x(n) - x(m)) + ABS(y(n) - y(m)), otherwise

Var(d) = 255.

 

Page: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16


Tutorials Table of Contents
AGI Command Reference Index

< Previous: Object Description CommandsNext: Inventory Item Management Commands >