/// <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> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here var kstate = Keyboard.GetState(); if (kstate.IsKeyDown(Keys.Up)) { player.Position.Y -= player.Speed * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (kstate.IsKeyDown(Keys.Down)) { player.Position.Y += player.Speed * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (kstate.IsKeyDown(Keys.Left)) { player.Position.X -= player.Speed * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (kstate.IsKeyDown(Keys.Right)) { player.Position.X += player.Speed * (float)gameTime.ElapsedGameTime.TotalSeconds; } if (physics.CollisionVsObject(player, snow)) { snow.Position.X += 1; } if (physics.OutOfBounds(player, world)) { snow.Position.X -= 1; } base.Update(gameTime); }