RotatePointAroundPoint
Introduction
Code Example
Sprite sprite;sprite = SpriteManager.AddSprite("redball.bmp");
sprite.X = 3; if (InputManager.Keyboard.KeyDown(Microsoft.Xna.Framework.Input.Keys.Space))
{
const float rotationRate = 10f; // in radians per second
const float xToRotateAbout = 0;
const float yToRotateAbout = 0;
// The starting point is the current location of the Sprite
float newX = sprite.X;
float newY = sprite.Y;
// Rotate the point and store the new position in
// newX and newY
FlatRedBall.Math.MathFunctions.RotatePointAroundPoint(
xToRotateAbout, yToRotateAbout,
ref newX, ref newY,
rotationRate * TimeManager.SecondDifference);
// Set the Sprite's new position to newX and newY
sprite.X = newX;
sprite.Y = newY;
}
Last updated
Was this helpful?