Example #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            //TODO: Add your drawing code here
            spriteBatch.Begin(
                SpriteSortMode.BackToFront,
                BlendState.AlphaBlend);

            if (gameState == GameState.TitleScreen)
            {
                spriteBatch.Draw(titleScreen, Vector2.Zero, Color.White);
            }
            else
            {
                TileMap.Draw(spriteBatch);
                player.Draw(spriteBatch);
                LevelManager.Draw(spriteBatch);

                /*spriteBatch.DrawString (
                 *      pericles8,
                 *      "Lives: " + player.LivesRemaining,
                 *      livesPosition,
                 *      Color.White);*/
                //if (gameState == GameState.GameOver)

                /*spriteBatch.DrawString (
                 *      pericles8,
                 *      "G A M E   O V E R !",
                 *      gameOverPosition,
                 *      Color.White);*/
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }
Example #2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            spriteBatch.Begin(
                SpriteSortMode.Immediate,
                BlendState.AlphaBlend);

            switch (gameState)
            {
            case GameState.TitleScreen:
                //spritebatch.Draw(titleScreen);
                myFont.DrawText(spriteBatch, menuPositions [0], "Jugar");
                myFont.DrawText(spriteBatch, menuPositions [1], "Instrucciones");
                myFont.DrawText(spriteBatch, menuPositions [2], "Salir");
                myFont.DrawText(spriteBatch, menuPositions [(int)menuOptions] - new Vector2(10, 0), ">");
                break;

            case GameState.Help:
                switch (helpIndex)
                {
                case 0:
                    spriteBatch.Draw(Content.Load <Texture2D>(@"Textures\HelpMenus\HelpMenu1"), Vector2.Zero, Color.White);
                    break;

                case 1:
                    spriteBatch.Draw(Content.Load <Texture2D>(@"Textures\HelpMenus\HelpMenu2"), Vector2.Zero, Color.White);
                    break;

                case 2:
                    spriteBatch.Draw(Content.Load <Texture2D>(@"Textures\HelpMenus\HelpMenu3"), Vector2.Zero, Color.White);
                    break;
                }
                break;

            case GameState.Playing:
            case GameState.Paused:
            case GameState.PlayerDead:
            case GameState.GameOver:
                TileMap.Begin(spriteBatch);
                player.Draw(spriteBatch);
                LevelManager.Draw(spriteBatch);
                TileMap.End(spriteBatch);
                myFont.DrawText(spriteBatch, scorePosition, "Drogas: " + player.drugCount.ToString());
                myFont.DrawText(spriteBatch, inyeccionPosition, "Inyecciones: " + player.inyecciones.ToString());
                myFont.DrawText(spriteBatch, livesPosition, "Vidas: " + player.LivesRemaining.ToString());
                myFont.DrawText(spriteBatch, framesPosition, (1 / (float)(gameTime.ElapsedGameTime.TotalSeconds)).ToString());
                if (gameState == GameState.GameOver)
                {
                    myFont.DrawText(spriteBatch, gameOverPosition, "G A M E O V E R !");
                }
                else if (gameState == GameState.Paused)
                {
                    spriteBatch.Draw(
                        Content.Load <Texture2D>(@"Textures\greenTexture"),
                        Camera.ViewPort,
                        Color.White);
                    myFont.DrawText(spriteBatch, pausePosition, "PAUSA");
                }
                break;
            }

            screen.Draw(spriteBatch);
            spriteBatch.End();
            base.Draw(gameTime);
        }