|
RotateSprite | ||
RotateSprite SpriteIndex, Angle# | ||
Parameters: SpriteIndex = The number of the sprite you wish to change Angle# = The angle (in degrees) by which you want to rotate this sprite |
||
Returns: NONE | ||
The RotateSprite command sets the rotation angle (in degrees) of this sprite. By default a sprites rotation axis or rotation hot spot as you might know it, is in the top left hand corner of it's attached image (See SpriteImage). So if we rotate the sprite, the sprite engine with turn our sprites coordinates around this point. You can shift the axis by setting the rotation handle (see SpriteHandle), allowing it rotate around it's center, or anywhere you want. The following is example of a sprite thats been rotated rotated at 10 degree intervals from 0 to 90 degrees. Here's an animated example of sprite rotating around it's center. The ship is rotating at 15 degree intervals. FACTS: * In order to see the effect of sprite rotation, the sprite needs to set to Rotation Mode using the SpriteDrawMode command. Sprites default drawmode is static/none rotated mode. * Note: For the best sprite rotation performance!, it's highly recommended that a sprites image be previously prepared in FX image format (see LoadFxIMage,LoadAFxIMage, PrepareFXimage ) * RotateSprite automatically wraps the sprites rotation angle to between 0-360 degrees for you. * The sprite engine will accept rotations less than one degree, but be aware that rounding might occur when rendering. * Also see TurnSprite is a short cut command Mini Tutorial: This example is really made up of three main parts. Part #1 creates a image out of a triangle shape and a circle. Part #2 creates the sprite, the sprite is then set to render the previously created image as it's graphic to rotate. Part #3 is the main do/loop. Which rotates the sprites and renders it
This example would output.
|
Related Info: | GetAngle2D | GetSpriteAngle | MoveSprite | PrepareFXimage | ScaleSprite | ScaleSpriteX | ScaleSpriteXY | ScaleSpriteY | SpriteDrawMode | TurnSprite : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |