Make a new float variable called
You can use the
MathHelper class to provide easy methods to convert degress to radians (the value
For example: (I use an origin for the rotation so it rotates around the center)
Rotation = MathHelper.ToRadians(180); //Rotate the sprite 180 degrees
SpriteBatch.Draw(TEXTURE, SPRITE_POSITION, null, Color.White, Rotation, new Vector2(TEXTURE.Width / 2, TEXTURE.Heigh / 2), 1, SpriteEffects.None, 1); //Draw TEXTURE with Rotation
Additionaly, I would recommend creating a sprite class to hold your Texture, Position, Rotation, Velocity, etc.
public class Sprite
public Sprite(Texture2D texture)
Texture = texture;
This way you can just do
Sprite sprite = new Sprite(TEXTURE) and have a nice object oriented approach to accessing it (
sprite.Texture, etc) and will probably help you later in the long run.
One of the bigest mistakes that will hurt you later is not applying elapsed time. If your FPS drops (different computer, running alot of programs, etc) or rises then your sprite will move faster, since it is depending on the update rate. You can solve this by applying elapsed time.
float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;
float speed = 10; //Will need tweaking, I cant remember a good value
sprite.Position -= elapsed * speed //Elapsed is so small so we must multiply by speed