public override void Update(GameTime gameTime) { currentGameTime = (float)gameTime.TotalGameTime.TotalSeconds; Vector2 movement = new Vector2(); // Update controls float moveSpeed; if (KeyboardManager.KeyDown(Keys.LeftShift) || GamepadManager.AButtonDown() || GamepadManager.AnyShoulderButtonDown()) { moveSpeed = speed / 2.5f; } else { moveSpeed = speed; } if (KeyboardManager.KeyDown(Keys.Left) || GamepadManager.LeftButtonDown()) { movement.X = -1 * (moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds); } if (KeyboardManager.KeyDown(Keys.Right) || GamepadManager.RightButtonDown()) { movement.X = (moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds); } if (KeyboardManager.KeyDown(Keys.Up) || GamepadManager.UpButtonDown()) { movement.Y = -1 * (moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds); } if (KeyboardManager.KeyDown(Keys.Down) || GamepadManager.DownButtonDown()) { movement.Y = (moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds); } if ((KeyboardManager.KeyDown(Keys.Space) || GamepadManager.XButtonDown()) && gameTime.TotalGameTime.TotalSeconds > nextFireTime && CanFire) { // Fire! AudioManager.PlaySoundEffect(GameScene.Shot3Sound, .2f); Bullet newBullet = mainEmitter.FireBullet(((float)Math.PI / 2) * 3, 500f, Color.GreenYellow, BulletType.Diamond, true); newBullet.SetCollisionLayer(2); newBullet.DrawLayer = .1f; nextFireTime = (float)gameTime.TotalGameTime.TotalSeconds + .1f; } // Calculate the movement from the sticks if they exist movement.X += (moveSpeed * GamepadManager.LeftStickX() * (float)gameTime.ElapsedGameTime.TotalSeconds); movement.Y -= (moveSpeed * GamepadManager.LeftStickY() * (float)gameTime.ElapsedGameTime.TotalSeconds); Position += movement; // Now clamp the position... if (Center.X - Origin.X < thisScene.ScreenArea.X) { Center = new Vector2(thisScene.ScreenArea.X + Origin.X, Center.Y); } else if (Center.X + Origin.X > thisScene.ScreenArea.X + thisScene.ScreenArea.Width) { Center = new Vector2(thisScene.ScreenArea.X + thisScene.ScreenArea.Width - Origin.X, Center.Y); } if (Center.Y - Origin.Y < thisScene.ScreenArea.Y) { Center = new Vector2(Center.X, thisScene.ScreenArea.Y + Origin.Y); } else if (Center.Y + Origin.Y > thisScene.ScreenArea.Y + thisScene.ScreenArea.Height) { Center = new Vector2(Center.X, thisScene.ScreenArea.Y + thisScene.ScreenArea.Height - Origin.Y); } //Test a hoolio base.Update(gameTime); }