/// <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) { // Allows the game to exit if ((GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) || Keyboard.GetState().IsKeyDown(Keys.Escape)) { #if !__IOS__ this.Exit(); #endif } //update the timer _clock.Update(gameTime); //update the input _inputState.Update(); _inputWrapper.Update(_inputState, false); //check veritcal movement if (_inputWrapper.Controller.CheckKeystrokeHeld(EKeystroke.Up)) { _circle1.Translate(0.0f, -circleMovementSpeed * _clock.TimeDelta); } else if (_inputWrapper.Controller.CheckKeystrokeHeld(EKeystroke.Down)) { _circle1.Translate(0.0f, circleMovementSpeed * _clock.TimeDelta); } //check horizontal movement if (_inputWrapper.Controller.CheckKeystrokeHeld(EKeystroke.Forward)) { _circle1.Translate(circleMovementSpeed * _clock.TimeDelta, 0.0f); } else if (_inputWrapper.Controller.CheckKeystrokeHeld(EKeystroke.Back)) { _circle1.Translate(-circleMovementSpeed * _clock.TimeDelta, 0.0f); } //add camera shake when the two circles crash into each other if (CollisionCheck.CircleCircleCollision(_circle1, _circle2)) { if (!_colliding) { _camera.AddCameraShake(0.25f); } _colliding = true; } else { _colliding = false; } //update the camera _camera.Update(_clock); base.Update(gameTime); }