SetShape

Category: Objects
Since engine version: 1.0 OC

Description

Changes the bounding rectangle of the object. This rectangle is used e.g. for collision or overlap detection. It does not affect object drawing.

Syntax

void SetShape(int x, int y, int width, int height);

Parameters

x:
X offset of the new shape.
y:
Y offset of the new shape.
width:
Width of the new shape.
height:
Height of the new shape.

Remark

In various situations the engine will reset the object's shape to the definition value. This might overwrite changes made with SetShape. This will happen e.g. during object rotation but also when resuming a saved game. So this function should only be used for mainly static, unchanging objects and you should read just the shape manually in synchronization calls like OnSynchronized.

Example

FindObject(Find_ID(Tree_Coniferous))->SetShape(-200,-300,400,600);
Enlarges the area or distance from which you can chop down one coniferous tree.
See also: SetVertex
Sven2, 2003-06