|
SpriteHandle | |||
SpriteHandle SpriteIndex, Xhandle, Yhandle | |||
Parameters: SpriteIndex = The identifier of the sprite you wish to create Xhandle = The handle offset along the X axis Yhandle = The handle offset along the Y axis |
|||
Returns: NONE | |||
SpriteHandle changes the display offset of a sprite. When a sprite is drawn, PlayBasic will render the sprites image data at the sprites current position, offset by it's handle. This allows us to change the point at which the image attaches onto the sprite. Sprite handles default to offset 0x, 0y. Which attach the image at it's top left hand coordinate. But you can can change these to any amount we like. They can even be outside of the image size, it doesn't matter. One of the most common needs for altering sprite handles occurs when we rotate a sprite, since we'll common want it to spin around it's center, rather than it's top left coordinate. While you can use SpriteHandle for that, it's recommended that you use CenterSpriteHandle since it's less work for you. Sprites can also automatically center their handles for you by activating AutoCenterSpriteHandle mode. Example Settings For the sake of simplicity, lets assume we have sprite with an image that's 100 pixels wide and 200 pixels high.
FACTS: * SpriteHandles Default to 0x,0Y * See CenterSpriteHandle to center a sprite handles on it's current image. * See AutoCenterSpriteHandle for auto centering Mini Tutorial: Create sprite, set it's handle, read the handle values back.
This example would output.
|
|||
Example Source: Download This Example
|
Related Info: | AutoCenterSpriteHandle | CenterSpriteHandle | GetAutoCenterSpriteHandle | GetSpriteHandleX | GetSpriteHandleY | SpriteImage : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |