Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- positionMouse = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
- //http://stackoverflow.com/a/7346855
- rotationAngle = (float)((Math.PI * 0.5f) + Math.Atan2(positionMouse.Y - positionShip.Y, positionMouse.X - positionShip.X));
- // TODO: Add your update logic here
- base.Update(gameTime);
- }
- /// <summary>
- /// This is called when the game should draw itself.
- /// </summary>
- /// <param name="gameTime">Provides a snapshot of timing values.</param>
- protected override void Draw(GameTime gameTime)
- {
- GraphicsDevice.Clear(Color.Gray);
- // TODO: Add your drawing code here
- spriteBatch.Begin();
- spriteBatch.Draw(
- image,
- positionShip,
- null,
- Color.White,
- rotationAngle,
- shipOrigin,
- 1.0f,
- SpriteEffects.None,
- 0f);
- spriteBatch.End();
- base.Draw(gameTime);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment