Example #1
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 (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // TODO: Add your update logic here
            base.Update(gameTime);
            TimeManager.Update(gameTime);
            InputManager.Update();
            base.Update(gameTime);

            TimeManager.Update(gameTime);
            InputManager.Update();

            _time += (float)TimeManager.ElapsedGameTime;
            if (InputManager.IsKeyDown(Keys.Left))
            {
                _radius += 5f;
            }
            if (InputManager.IsKeyDown(Keys.Right))
            {
                _radius -= 5f;
            }
            if (InputManager.IsKeyDown(Keys.Down))
            {
                _speed -= 0.1f;
            }
            if (InputManager.IsKeyDown(Keys.Up))
            {
                _speed += 0.1f;
            }
            if (InputManager.IsKeyDown(Keys.LeftAlt))
            {
                _wobbling -= 0.1f;
            }
            if (InputManager.IsKeyDown(Keys.LeftControl))
            {
                _wobbling += 0.1f;
            }



            spriteAnimator.AnimateSpiralSinusoidal(_radius, _time, _speed, _wobbling);


            base.Update(gameTime);
        }