|
TurnSprite | |||
TurnSprite SpriteIndex, Angle# | |||
Parameters: SpriteIndex = The number of the sprite you wish to check Angle# = The angle you wish to rotate this sprite |
|||
Returns: NONE | |||
The TurnSprite command changes (turns) the current rotation angle of the sprite. Turning the sprite a positive value turns it clockwise and a negative value will turn it anticlockwise. The rotation angle with wrap if the angle exceeds 360 degrees and drops bellow 0. So it'll always be in 0-360 range. TurnSprite is a short cut command much like MoveSprite, where it's main usage is to reduce code complexity. You can achieve equivalent functionality using the RotateSprite command as per the following example. But turn sprite is simpler and faster.
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 sprite rotation, the sprites Drawmode needs to set to Rotation Mode. See SpriteDrawMode command. * Note: For the best performance!, it's highly recommended that a scaled sprites image be previously prepared/loaded in FX image format (see PrepareFXimage, LoadFXImage) * Also see RotateSprite Mini Tutorial: This example is really 3 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 allows the user to rotates the sprites with the left/right arrows key controls and then renders it
This example would output.
|
Related Info: | GetSpriteAngle | PrepareFXImage | RotateSprite | ScaleSprite | SpriteDrawMode : |
|
|||||||||||||||||||||||||||||||||||||||
(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com |