spacer graphic
spacer graphic
Montage of games AGS Logo
spacer graphic

 

spacer graphic
Menu
spacer graphic Home
About
News
Features
Download AGS
spacer graphic Games 
Games main page
Award Winners
Picks of the month
Short games
Medium length games
Full length games
In Production
Hints & Tips
Community
Forums
AGSers World Map
Member websites
Chat
Resources
Tutorials
FAQ
Knowledge Base
Downloads
Links
AGS-related links
* AGS Manual
  * Scripting
    * DynamicSprite functions and properties

Rotate (dynamic sprite)

DynamicSprite.Rotate(int angle, optional int width, optional int height)
Rotates the dynamic sprite by the specified angle. The angle is in degrees, and must lie between 1 and 359. The image will be rotated clockwise by the specified angle.

Optionally, you can specify the width and height of the rotated image. By default, AGS will automatically calculate the new size required to hold the rotated image, but you can override this by passing the parameters in.

Note that specifying a width/height does not stretch the image, it just allows you to set the image dimensions to crop the rotation.

NOTE: Rotating is a relatively slow operation, so do not attempt to rotate sprites every game loop; only do it when necessary.

Example:

DynamicSprite* sprite = DynamicSprite.CreateFromFile("CustomAvatar.bmp");
sprite.Rotate(90);
DrawingSurface *surface = Room.GetDrawingSurfaceForBackground();
surface.DrawImage(100, 100, sprite.Graphic);
surface.Release();
sprite.Delete();
will load the CustomAvatar.bmp image, rotate it 90 degrees clockwise, draw the result onto the screen, and then delete the image.

See Also: DynamicSprite.Flip, DynamicSprite.Resize, DynamicSprite.Height, DynamicSprite.Width


User comments and notes
There are currently no user comments on this page.
The user comment facility is currently disabled.