AGK for Pascal
TAgkSprite.SetOffset Method (Single, Single)

Sets the offset point. The offset point is the point that the sprite will rotate around, with (0,0) being the top left corner and (Width,Height) being the bottom right corner.

procedure SetOffset(const X: Single; const Y: Single); overload;
const X: Single 
The X distance from the top left corner to offset the rotation point. 
const Y: Single 
The Y distance from the top left corner to offset the rotation point. 

By default, the offset is set to the center of the sprite. 

The offset can also be used to position the sprite using SetPositionByOffset, whilst SetPosition will always position the sprite using its top left corner. If the sprite is scaled remember to take the scale into account: A sprite created as 10 by 10 units wide scaled by 0.5 will have a bottom right corner at 5,5. So to position the offset in the center would mean placing it at 2.5,2.5, when the sprite is scale back up the offset point will scale with it to maintain its relative position. 

This command forces the recalculation of the sprite's shape due to a new center point, additional shapes are not recalculated so will become distorted from their original definition. It is not recommended calling this command on a sprite already setup for physics. Change the offset before applying physics or additional shapes.

Copyright (c) 2012. All rights reserved.