The GetSpriteScaleY function returns the current amount of Y scaling applied to a sprite.
FACTS:
* See ScaleSprite to scale a sprite.
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 scales the sprites width and height and then renders it
; =========================== ; Part 1 - Create our image ; =========================== Cls RGB(0,0,0) ; Create a Little triangle image Size=50 CreateConvexShape 1,Size*0.50,3 RotateShape 1,30,1 DrawShape 1,Size/2,size/2,2 CircleC size/2,size/2,size/5,1,RndRGB() CircleC size/4,size/4,size/6,1,RndRGB() MyImage=GetFreeImage() GetImage MyImage,0,0,size,size PrepareFXImage MyImage ; =========================== ; Part 2 - Create our sprites ; =========================== ; Create the Sprite CreateSprite 1 ; set this sprite to use the previously created image SpriteImage 1,MyImage ; set the sprites drawing mode to ROTATION/SCALE (mode 2) SpriteDrawMode 1,2 ; Position the sprite at 100,100 PositionSprite 1,100,100 ; ======================== ; Part 3 - The main Loop ; ======================== ; Start a do/loop Do ; clear the screen Cls RGB(0,0,0) ; bump the scaler angle Angle#=WrapAngle(angle#,1) ; Set Sprites 1's X scaling factor ScaleSpriteX 1,2+CosRadius(angle#,0.5) ; Set Sprites 1's Y scaling factor ScaleSpriteY 1,2+SinRadius(angle#,0.5) ; Display the current scaling of this sprite Print "Sprite Scaling Stuff" Print "Sprites Scale X:"+Str$(GetSpriteScaleX(1)) Print "Sprites Scale Y:"+Str$(GetSpriteScaleY(1)) ; Draw all the created sprites DrawAllSprites ; Draw the screen Sync ; Loop back to the DO statement Loop |
This example would output. Sprites Scale X: 2.34 Sprites Scale Y: 2.89 |
|