SLUDGE

addScreenRegion


Syntax:

addScreenRegion (thisObject, left, top, right, bottom, sX, sY, direction);

Purpose:

Adds a rectangular region on the screen which represents thisObject. The region is the rectangle from (left, top) to (right, bottom) inclusive.

If a character is told to move to thisObject using either of the forceCharacter or moveCharacter commands, the position at which the character should try and stand is (sX, sY). If direction is -1, the character will be left facing in whatever direction it was last walking. Otherwise, the character will be turned to face direction (which can either be an angle, in degrees, or one of the enumerations NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST or NORTHWEST).

If characters should not move when told to walk to a certain object, set both sX and sY to 0. The value of direction is not used in this instance, although it must still be provided.

Return value:

No return value.

Example:

objectType poster ("poster") {
}

objectType horizon ("horizon") {
}

sub init () {
   addScreenRegion (poster, 100, 100, 150, 200, 125, 250, NORTH);
   addScreenRegion (horizon, 300, 150, 600, 170, 0, 0, -1);

   forceCharacter (ego, poster);
   # ego will now be standing at (125, 250) facing north

   forceCharacter (ego, horizon);
   # That command won't move the ego anywhere
}

See also:

Object Types and Events

getOverObject

isScreenRegion

onFocusChange

removeAllScreenRegions