Beispiel #1
0
 public override void Update(GameTime gameTime, GraphicsDevice graphicsDevice)
 {
     base.Update(gameTime, graphicsDevice);
     if (backButton.CheckMouseCollision(newState))
     {
         backButton.Update(2);
         if (MouseButtonClicked())
         {
             buttonClickSound.Play();
             nextScreen = "MainMenu"; //Remember to set the screen to game screen
         }
         else
         {
             nextScreen = "PauseMenu";
         }
     }
     else if (exitButton.CheckMouseCollision(newState))
     {
         buttonClickSound.Play();
         nextScreen = "TitleScreen";
     }
     else if (optionsButton.CheckMouseCollision(newState))
     {
         buttonClickSound.Play();
         nextScreen = "OptionsMenu";
     }
     else
     {
         nextScreen = "PauseMenu";
         optionsButton.ResetFrame();
         exitButton.ResetFrame();
         backButton.ResetFrame();
     }
 }
Beispiel #2
0
        public override void Update(GameTime gameTime, GraphicsDevice graphicsDevice)
        {
            base.Update(gameTime, graphicsDevice);
            if (backButton.CheckMouseCollision(newState))
            {
                backButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    nextScreen = previousScreen;
                }
                else
                {
                    nextScreen = "OptionsMenu";
                }
            }

            else if (minusButton.CheckMouseCollision(newState))
            {
                minusButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    MediaPlayer.Volume -= .1f; //Lowers music volume if minus button is clicked
                }
                else
                {
                    nextScreen = "OptionsMenu";
                }
            }

            else if (plusButton.CheckMouseCollision(newState))
            {
                plusButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    MediaPlayer.Volume += .1f; //Raises music volume is plus button is clicked
                }
                else
                {
                    nextScreen = "OptionsMenu";
                }
            }

            else
            {
                nextScreen = "OptionsMenu"; //Resets the frames of the buttons if mouse isn't colliding with them
                backButton.ResetFrame();
                minusButton.ResetFrame();
                plusButton.ResetFrame();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Updates screen if mouse collision is detected and mouse button clicked
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime, GraphicsDevice graphicsDevice)
        {
            base.Update(gameTime, graphicsDevice);

            if (playButton.CheckMouseCollision(newState))
            {
                playButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    nextScreen = "LoadMenu";
                }
                else
                {
                    nextScreen = "MainMenu";
                }
            }
            else if (optionsButton.CheckMouseCollision(newState))
            {
                optionsButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    nextScreen = "OptionsMenu";
                }
                else
                {
                    nextScreen = "MainMenu";
                }
            }
            else if (backButton.CheckMouseCollision(newState))
            {
                backButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    nextScreen = "TitleScreen";
                }
                else
                {
                    nextScreen = "MainMenu";
                }
            }
            else
            {
                nextScreen = "MainMenu";
                optionsButton.ResetFrame();
                playButton.ResetFrame();
                backButton.ResetFrame();
            }
        }
Beispiel #4
0
        public override void Update(GameTime gameTime, GraphicsDevice graphicsDevice)
        {
            base.Update(gameTime, graphicsDevice);

            if (newGameButton.CheckMouseCollision(newState))
            {
                newGameButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    nextScreen = "Gameplay";
                }
                else
                {
                    nextScreen = "LoadMenu";
                }
            }
            else if (loadButton.CheckMouseCollision(newState))
            {
                loadButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    nextScreen = "Gameplay";
                }
                else
                {
                    nextScreen = "LoadMenu";
                }
            }
            else if (backButton.CheckMouseCollision(newState))
            {
                backButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    nextScreen = "MainMenu";
                }
                else
                {
                    nextScreen = "LoadMenu";
                }
            }
            else if (continueButton.CheckMouseCollision(newState))
            {
                continueButton.Update(2);
                if (MouseButtonClicked())
                {
                    buttonClickSound.Play();
                    nextScreen = "Gameplay";
                }
                else
                {
                    nextScreen = "LoadMenu";
                }
            }
            else
            {
                nextScreen = "LoadMenu";
                newGameButton.ResetFrame();
                loadButton.ResetFrame();
                continueButton.ResetFrame();
                backButton.ResetFrame();
            }
        }