AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.SetShapeCircle Method

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

Syntax
Pascal
procedure SetShapeCircle(const X: Single; const Y: Single; const Radius: Single);
Parameters 
Description 
const X: Single 
The X coordinate of the center of the circle in sprite space. 
const Y: Single 
The Y coordinate of the center of the circle in sprite space. 
const Radius: Single 
The radius of the circle. 

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 circle is defined by specifying its center point relative to the sprite's current offset and a radius. For example, if the circle was to be centered on the sprite's offset point it would be specified at position 0,0. Any other value will offset the circle from the sprite. The radius is defined in x coordinates, due to world coordinates not necessarily representing the size of items on screen (e.g. 10 units in X may not be the same apparent size as 10 units in Y). 

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

Copyright (c) 2012. All rights reserved.