UEXDev

PlayScene Update Aufruf mit InputManager

May 8th, 2012
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. public override void Update(GameTime gameTime)
  2. {
  3.     base.Update(gameTime);
  4.  
  5.     // Move Left!
  6.     if (InputManager.IsKeyDown(Keys.A))
  7.         camera.Move(new Vector2(5, 0));
  8.  
  9.     // Move Right!
  10.     if (InputManager.IsKeyDown(Keys.D))
  11.         camera.Move(new Vector2(-5, 0));
  12.  
  13.     // Move Down!
  14.     if (InputManager.IsKeyDown(Keys.S))
  15.         camera.Move(new Vector2(0, -5));
  16.  
  17.     // Move Up!
  18.     if (InputManager.IsKeyDown(Keys.W))
  19.         camera.Move(new Vector2(0, 5));
  20.  
  21.     // Zoom In
  22.     if (InputManager.IsKeyPressed(Keys.PageUp))
  23.         camera.Zoom += 0.05f;
  24.  
  25.     // Zoom Out
  26.     if (InputManager.IsKeyPressed(Keys.PageDown))
  27.         camera.Zoom -= 0.05f;
  28.  
  29.     // Rotate Counter Clockwise
  30.     if (InputManager.IsKeyDown(Keys.J))
  31.         camera.Rotation -= 0.01f;
  32.  
  33.     // Rotate Clockwise
  34.     if (InputManager.IsKeyDown(Keys.K))
  35.         camera.Rotation += 0.01f;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment