evgeni_tsn

Untitled

Dec 1st, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1.  
  2.             positionMouse = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
  3.             //http://stackoverflow.com/a/7346855
  4.             rotationAngle = (float)((Math.PI * 0.5f) + Math.Atan2(positionMouse.Y - positionShip.Y, positionMouse.X - positionShip.X));
  5.             // TODO: Add your update logic here
  6.  
  7.             base.Update(gameTime);
  8.         }
  9.  
  10.         /// <summary>
  11.         /// This is called when the game should draw itself.
  12.         /// </summary>
  13.         /// <param name="gameTime">Provides a snapshot of timing values.</param>
  14.         protected override void Draw(GameTime gameTime)
  15.         {
  16.             GraphicsDevice.Clear(Color.Gray);
  17.  
  18.             // TODO: Add your drawing code here
  19.             spriteBatch.Begin();
  20.  
  21.  
  22.             spriteBatch.Draw(
  23.                 image,
  24.                 positionShip,
  25.                 null,
  26.                 Color.White,
  27.                 rotationAngle,
  28.                 shipOrigin,
  29.                 1.0f,
  30.                 SpriteEffects.None,
  31.                 0f);
  32.  
  33.             spriteBatch.End();
  34.  
  35.             base.Draw(gameTime);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment