Ejemplo n.º 1
0
        public void Update()
        {
            KeyboardState currentState    = Keyboard.GetState();
            GamePadState  currentPadState = GamePad.GetState(PlayerIndex.One);

            if (!musicPlaying)
            {
                MediaPlayer.Play(game.bgMusic);
                MediaPlayer.IsRepeating = true;
                musicPlaying            = true;
            }


            if (game.keyJustPressed(lastState, currentState, Keys.Escape) || game.padPressed(currentPadState, Buttons.Back))
            {
                game.Exit();
            }


            if (game.keyJustPressed(lastState, currentState, Keys.Enter) || game.padJustPressed(lastPadState, currentPadState, Buttons.Start))
            {
                game.setMode(game.PLAY);
                game.ResetElapsedTime();
            }


            if (game.keyJustPressed(lastState, currentState, Keys.Right) || game.padJustPressed(lastPadState, currentPadState, Buttons.DPadRight))
            {
                gameDiff = hard;
            }

            if (game.keyJustPressed(lastState, currentState, Keys.Left) || game.padJustPressed(lastPadState, currentPadState, Buttons.DPadLeft))
            {
                gameDiff = easy;
            }

            lastState    = currentState;
            lastPadState = currentPadState;
        }