Beispiel #1
0
 /// <summary>
 /// Allows the game to run logic such as updating the world,
 /// checking for collisions, gathering input, and playing audio.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 public void Update(GameContext context, GameTime gameTime)
 {
     if (/*GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||*/ Keyboard.GetState().IsKeyDown(Keys.Escape))
     {
         context.State = StateFactory.GetState(typeof(Menu));
     }
     // TODO: Add your update logic here
     //playerShip.Update(gameTime);
     world.Update(gameTime);
 }
Beispiel #2
0
 public void Update(GameContext context, GameTime gameTime)
 {
     currentKeyboardState = Keyboard.GetState();
     if (currentKeyboardState.IsKeyDown(Keys.W) || currentKeyboardState.IsKeyDown(Keys.Up))
     {
         menuItem = 0;
     }
     if (currentKeyboardState.IsKeyDown(Keys.S) || currentKeyboardState.IsKeyDown(Keys.Down))
     {
         menuItem = 1;
     }
     if (menuItem == 1 && currentKeyboardState.IsKeyDown(Keys.Enter))
     {
         context.Exit();
     }
     if (menuItem == 0 && currentKeyboardState.IsKeyDown(Keys.Enter))
     {
         context.State = StateFactory.GetState(typeof(Game1));
     }
 }