RotateToAccurate
Introduction
Code Example
using FlatRedBall.Input;
using FlatRedBall.Instructions;Sprite sprite;sprite = SpriteManager.AddSprite("redball.bmp");
sprite.ScaleX = 4;if (InputManager.Mouse.ButtonReleased(FlatRedBall.Input.Mouse.MouseButtons.LeftButton))
{
float angle = (float)(System.Math.Atan2(
InputManager.Mouse.WorldYAt(0) - sprite.Y,
InputManager.Mouse.WorldXAt(0) - sprite.X));
float secondsToTake = 1;
// Just in case there are other instructions around from the
// last call:
sprite.Instructions.Clear();
// Adds instructions to the Sprite's Instructions list.
InstructionManager.RotateToAccurate(sprite, 0, 0, angle, secondsToTake);
}
Last updated
Was this helpful?