AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.SetShapePolygon Method

Overrides the current auto generated shape for use in collision detection, hit testing, and physics. Set the shape to a polygon.

Syntax
Pascal
procedure SetShapePolygon(const NumPoints: Integer; const Index: Integer; const X: Single; const Y: Single);
Parameters 
Description 
const NumPoints: Integer 
The number of points to use in the polygon, min 2, max 12. 
const Index: Integer 
The index of the polygon 
const X: Single 
X coordinate of the polygon to be added 
const Y: Single 
Y coordinate of the polygon to be added 

A shape can be set without turning physics on, and by default all sprites are set to use the box shape, which is the fastest to setup. The polygon is defined by a set of points (between 2 and 12) relative to the current sprite's offset. For example, a point of 0,0 would be centered on the sprite's offset point, any other value will be offset from this point. 

Setting a shape removes all other shapes assigned to the sprite and replaces it with this one.

Copyright (c) 2012. All rights reserved.