Ejemplo n.º 1
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Menu.LoadContent(Content, 5, new int[] { 1, 4, 1, 1, 3 });

            titleTexture = Content.Load <Texture2D>(@"Textures/Menu/title");
            InGame.LoadContent(Content);
            SaveFile.LoadContent(Content);
            InGame.Reset();
        }
Ejemplo n.º 2
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Red);
            switch (gameState)
            {
            case GameStates.Intro:
                GraphicsDevice.Clear(Color.Black);
                spriteBatch.Begin();
                Menu.Draw(spriteBatch, 0, -500, 0);
                spriteBatch.End();
                break;

            case GameStates.Menu:
                spriteBatch.Begin();
                Menu.Draw(spriteBatch, 350 - 262 / 2, 250, 30);
                spriteBatch.Draw(titleTexture, new Microsoft.Xna.Framework.Rectangle(0, 0, 700, 700), Color.White);
                spriteBatch.End();
                break;

            case GameStates.InGame:
                spriteBatch.Begin();
                Menu.Draw(spriteBatch, 0, 0, 0);
                InGame.Draw(spriteBatch);

                spriteBatch.End();
                break;

            case GameStates.Highscore:
                spriteBatch.Begin();
                Menu.Draw(spriteBatch, 350 - 262 / 2, 770, 0);
                SaveFile.Draw(spriteBatch);
                spriteBatch.End();
                break;

            case GameStates.Credits:
                spriteBatch.Begin();
                Menu.Draw(spriteBatch, 350 - 262 / 2, 770, 0);

                spriteBatch.End();
                break;

            case GameStates.GameOver:
                spriteBatch.Begin();
                Menu.Draw(spriteBatch, 350 - 262 / 2, 500, 30);
                spriteBatch.End();

                break;
            }

            base.Draw(gameTime);
        }
Ejemplo n.º 3
0
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
                Keyboard.GetState().IsKeyDown(Keys.End) ||
                Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }



            switch (gameState)
            {
            case GameStates.Intro:
                Menu.MenuState = 0;
                Menu.Update(gameTime);
                if (Menu.Select(1))
                {
                    gameState = GameStates.Menu;
                }

                break;

            case GameStates.Menu:
                Menu.MenuState = 1;
                Menu.Update(gameTime);
                if (Menu.Select(1))
                {
                    InGame.Reset();
                    gameState = GameStates.InGame;
                }
                if (Menu.Select(2))
                {
                    gameState = GameStates.Highscore;
                }
                if (Menu.Select(3))
                {
                    gameState = GameStates.Credits;
                }
                if (Menu.Select(4))
                {
                    this.Exit();
                }

                break;

            case GameStates.InGame:
                InGame.Update(gameTime);
                break;

            case GameStates.Highscore:
                Menu.MenuState = 2;
                Menu.Update(gameTime);
                if (Menu.Select(1))
                {
                    gameState = GameStates.Menu;
                }

                if (Keyboard.GetState().IsKeyDown(Keys.R) && Keyboard.GetState().IsKeyDown(Keys.LeftShift))
                {
                    SaveFile.ResetHighScore();
                }
                break;

            case GameStates.Credits:
                Menu.MenuState = 3;
                if (Menu.Select(1))
                {
                    gameState = GameStates.Menu;
                }
                Menu.Update(gameTime);

                break;

            case GameStates.GameOver:
                Menu.MenuState = 4;
                if (Menu.Select(1))
                {
                    gameState = GameStates.InGame;
                }

                if (Menu.Select(2))
                {
                    gameState = GameStates.Highscore;
                }
                if (Menu.Select(3))
                {
                    gameState = GameStates.Menu;
                }
                Menu.Update(gameTime);

                break;
            }

            base.Update(gameTime);
        }