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
|