SetSpriteOffset

Description

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. The offset can also be used to position the sprite using SetSpritePositionByOffset, whilst SetSpritePosition 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.

Definition

SetSpriteOffset( iSpriteIndex, x, y )

Parameters