public override void Update(GameTime gameTime) { if (KInput.IsKeyPressed(Keys.Escape)) { Engine.Exit(); } base.Update(gameTime); }
protected override void Update(GameTime gameTime) { base.Update(gameTime); KInput.Update(); if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } screenManager.Update(gameTime); }
public override void Update(GameTime gameTime) { //KeyboardState k = Keyboard.GetState(); if (KInput.IsKeyDown(Keys.S)) { Speed = 6f; YAcceleration = 0f; } if (KInput.IsKeyDown(Keys.Left)) { Direction += .1f; } if (KInput.IsKeyDown(Keys.Right)) { Direction -= .1f; } if (KInput.IsKeyDown(Keys.Down)) { YAcceleration = .2f; } if (!Scene.Dimensions.Contains(NextBoundingBox)) { // Lookup Graphics Viewport about XNA on the interwebs if (BoundingBox.Left < 0 || BoundingBox.Right > Scene.Width) { XVelocity *= -1; } if (BoundingBox.Top < 0 || BoundingBox.Bottom > Scene.Height) { YVelocity *= -1; if (YVelocity < .001f && YVelocity > -.001f) { YVelocity = 0; Y = Scene.Height - (Sprite.Height - Sprite.Origin.Y); } } if (!Scene.Dimensions.Intersects(NextBoundingBox)) { Y = 50; } } base.Update(gameTime); }