/// <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);
        }
Esempio n. 2
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>
        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);

            //move the circle
            float movespeed = 1600.0f;

            //check veritcal movement
            if (_inputWrapper.Controller.CheckKeystrokeHeld(EKeystroke.Up))
            {
                _circle1.Translate(0.0f, -movespeed * _clock.TimeDelta);
            }
            else if (_inputWrapper.Controller.CheckKeystrokeHeld(EKeystroke.Down))
            {
                _circle1.Translate(0.0f, movespeed * _clock.TimeDelta);
            }

            //check horizontal movement
            if (_inputWrapper.Controller.CheckKeystrokeHeld(EKeystroke.Forward))
            {
                _circle1.Translate(movespeed * _clock.TimeDelta, 0.0f);
            }
            else if (_inputWrapper.Controller.CheckKeystrokeHeld(EKeystroke.Back))
            {
                _circle1.Translate(-movespeed * _clock.TimeDelta, 0.0f);
            }

            //add camera shake?
            if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.A))
            {
                _camera.AddCameraShake(0.5f);
            }

            //update the camera
            _camera.Update(_clock);

            base.Update(gameTime);
        }
Esempio n. 3
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>
        protected override void Update(GameTime gameTime)
        {
#if !__IOS__
            // Allows the game to exit
            if ((GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) ||
                Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }
#endif

            //update the timer
            _clock.Update(gameTime);

            //update the input
            _inputState.Update();
            _inputWrapper.Update(_inputState, false);

            _Grid.Update(_inputWrapper);

            base.Update(gameTime);
        }
Esempio n. 4
0
        protected override void Update(GameTime gameTime)
        {
            if (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 input to increment/decrement the current bullet pattern
            if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.LShoulder))
            {
                //decrement the pattern
                if (0 >= _CurrentPattern)
                {
                    //if it is at the beginning, move to the end
                    _CurrentPattern = _myPatterns.Count - 1;
                }
                else
                {
                    _CurrentPattern--;
                }

                AddBullet();
            }
            else if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.RShoulder))
            {
                //increment the pattern
                if ((_myPatterns.Count - 1) <= _CurrentPattern)
                {
                    //if it is at the beginning, move to the end
                    _CurrentPattern = 0;
                }
                else
                {
                    _CurrentPattern++;
                }

                AddBullet();
            }

            //reset the bullet pattern
            if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.A))
            {
                AddBullet();
            }

            //increase/decrease the rank
            if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.LShoulder))
            {
                if (_Rank > 0.0f)
                {
                    _Rank -= 0.1f;
                }

                if (_Rank < 0.0f)
                {
                    _Rank = 0.0f;
                }
            }
            else if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.RShoulder))
            {
                if (_Rank < 1.0f)
                {
                    _Rank += 0.1f;
                }

                if (_Rank > 1.0f)
                {
                    _Rank = 1.0f;
                }
            }

            //if y is held down, do some slowdown
            if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.Y))
            {
                _moverManager.TimeSpeed = 0.5f;
            }
            else
            {
                _moverManager.TimeSpeed = 1.0f;
            }

            //if b is held down, make it bigger
            if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.LTrigger))
            {
                _moverManager.Scale -= 0.1f;
            }
            else if (_inputWrapper.Controller.CheckKeystroke(EKeystroke.RTrigger))
            {
                _moverManager.Scale += 0.1f;
            }

            _moverManager.Update();

            myship.Update();

            base.Update(gameTime);
        }
Esempio n. 5
0
 public virtual void DoUpdate()
 {
     mInputWrapper.Update();
 }