The GetSpriteAngle function returns the current rotation angle of a sprite.
FACTS:
* Also see RotateSprite, TurnSprite, SpriteDrawMode
Mini Tutorial:
This example is really 3 parts. The first part 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
; ======================== ; Part 1 - Create an image ; ======================== Cls RGB(0,0,0) ; Create a LIttle triangle image Size=50 MyShape=NewConvexShape(Size*0.50,3) RotateShape MyShape,30,1 DrawShape MyShape,Size/2,size/2,2 CircleC size/2,size/2,size/5,1,RndRGB() MyImage=NewFXImage(Size,size) GetImage MyImage,0,0,size,size ; ======================== ; Part 2 - Create our sprite ; ======================== ; Create the Sprite MySprite=NewSprite(100,100,MyImage) ; Set sprite Center it's handle on any image AutoCenterSpriteHandle 1,true ; set the sprites drawing mode to ROTATION (mode 2) SpriteDrawMode 1,2 ; ======================== ; Part 3 - The main Loop ; ======================== SetFPS 30 ; Start a do/loop Do ; clear the screen Cls RGB(0,0,0) ;Turn sprite 1 to the right 2 degrees TurnSprite MyImage,2 ; display the current angle of rotation Print "Sprite Rotation Angle:"+Str$(GetSpriteAngle(MyImage)) ; Draw all the created sprites DrawAllSprites ; Draw the screen Sync ; Loop back to the DO statement Loop |
Sample text output from this example. Sprite Rotation Angle:2.00 |
|