示例#1
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();

        if (gameState == GameState.Playing)
        {
            grid.Draw(gameTime, spriteBatch);
            tetrisBlock.Draw(gameTime, spriteBatch);
            drawBlock.Draw(gameTime, spriteBatch);
            spriteBatch.DrawString(font, "Score = " + score, new Vector2(350, 275), Color.Black);
            spriteBatch.DrawString(font, "Rows till next level = " + rowsToGo, new Vector2(350, 250), Color.Black);
            spriteBatch.DrawString(font, "Level = " + level, new Vector2(350, 300), Color.Black);
            spriteBatch.Draw(controls, new Vector2(600, 0), Color.White);
        }
        else if (gameState == GameState.Init)
        {
            spriteBatch.Draw(background, Vector2.Zero, Color.White);
            spriteBatch.Draw(emptyCell, mousePos, Color.Red);
        }
        else
        {
            spriteBatch.Draw(endScreen, Vector2.Zero, Color.White);
            spriteBatch.DrawString(menuFont, "Score = " + score, new Vector2(180, 300), Color.Black);
            spriteBatch.DrawString(menuFont, "Level = " + level, new Vector2(680, 300), Color.Black);
        }
        spriteBatch.End();
    }
示例#2
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();
        if (gameState == GameState.Menu)
        {
            spriteBatch.Draw(logo, new Vector2(TetrisGame.ScreenSize.X / 3 - 10, 30), Color.White);
            spriteBatch.DrawString(font, "Press SPACE To Start Game", new Vector2(TetrisGame.ScreenSize.X / 3, TetrisGame.ScreenSize.Y / 2), Color.Black);
        }
        else if (gameState == GameState.Playing)
        {
            grid.Draw(gameTime, spriteBatch);
            tetrisblock.Draw(gameTime, spriteBatch);
            nextTetrisBlock.Draw(gameTime, spriteBatch);
            spriteBatch.DrawString(font, "Score: " + Score, new Vector2(TetrisGame.ScreenSize.X / 2, 0), Color.Black);
            spriteBatch.DrawString(font, "Level: " + level, new Vector2(TetrisGame.ScreenSize.X - (TetrisGame.ScreenSize.X / 3), 0), Color.Black);
            if (leveltimer + 1 > gameTime.TotalGameTime.Seconds && leveltimer != 0)
            {
                spriteBatch.DrawString(font, "LEVEL UP!", new Vector2(TetrisGame.ScreenSize.X / 2, 320), Color.Black);
            }
        }

        else if (gameState == GameState.GameOver)
        {
            spriteBatch.DrawString(font, "GAME OVER", new Vector2(TetrisGame.ScreenSize.X / 3 + 75, TetrisGame.ScreenSize.Y / 2), Color.Blue);
            spriteBatch.DrawString(font, "Press SPACE To Try Again", new Vector2(TetrisGame.ScreenSize.X / 4 + 75, TetrisGame.ScreenSize.Y / 2 + 50), Color.Blue);
            Reset();
        }
        spriteBatch.End();
    }
示例#3
0
 public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     if (gameState == GameState.TitleSceen)
     {
         title.Draw(spriteBatch);
     }
     if (gameState == GameState.HelpScreen)
     {
         help.Draw(spriteBatch);
     }
     if (gameState == GameState.Playing)
     {
         spriteBatch.Begin();
         grid.Draw(gameTime, spriteBatch);
         block.Draw(spriteBatch);
         nextBlock.Draw(spriteBatch);
         score.Draw(spriteBatch);
         hold.Draw(spriteBatch);
         spriteBatch.End();
     }
     if (gameState == GameState.GameOverScreen)
     {
         over.Draw(spriteBatch);
     }
 }
示例#4
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();
        grid.Draw(gameTime, spriteBatch);

        spriteBatch.End();
    }
示例#5
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();
        switch (gameState) //Draws the sprites for each gamestate
        {
        case GameState.StartScreen:
            spriteBatch.Draw(StartScreen, Vector2.Zero, Color.White);
            break;

        case GameState.PlayingVSMode:
            VSSideBarPlayer1.Draw(gameTime, spriteBatch, "Z", "X", "C");
            VSSideBarPlayer2.Draw(gameTime, spriteBatch, "M", "<,", ">.");
            grid2.Draw(gameTime, spriteBatch);
            grid1.Draw(gameTime, spriteBatch);
            break;

        case GameState.HighScoreMode:
            VSSideBarPlayer2.Draw(gameTime, spriteBatch);
            grid2.Draw(gameTime, spriteBatch);
            goto case GameState.PlayingSinglePlayer;

        case GameState.PlayingSinglePlayer:
            VSSideBarPlayer1.Draw(gameTime, spriteBatch);
            grid1.Draw(gameTime, spriteBatch);
            break;

        case GameState.GameOverSinglePlayer:
            spriteBatch.Draw(GameOverSinglePlayer, Vector2.Zero, Color.White);
            spriteBatch.DrawString(font, "Score : " + grid1.Score.ToString(), new Vector2(TetrisGame.ScreenSize.X / 2 - 115, TetrisGame.ScreenSize.Y / 2 + 200), Color.Blue, 0f, Vector2.Zero, 3f, SpriteEffects.None, 0f);
            break;

        case GameState.Player1Wins:
            spriteBatch.Draw(Player1Wins, new Vector2(-60, 0), Color.White);
            break;

        case GameState.Player2Wins:
            spriteBatch.Draw(Player2Wins, new Vector2(-60, 0), Color.White);
            break;

        case GameState.Tie:
            spriteBatch.Draw(Tie, new Vector2(-60, 0), Color.White);
            break;
        }
        spriteBatch.End();
    }
示例#6
0
 public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     spriteBatch.Begin();
     grid.Draw(gameTime, spriteBatch);
     useBlock.Draw(gameTime, spriteBatch);
     previewBlock.Draw(gameTime, spriteBatch);
     spriteBatch.DrawString(font, "Score:" + (int)score, new Vector2(360, 5), Color.Blue);
     spriteBatch.End();
 }
示例#7
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();
        grid.Draw(gameTime, spriteBatch);
        tetPDU.Draw(gameTime, spriteBatch);

        //DrawText("Hello!", Vector2.Zero, spriteBatch);
        spriteBatch.End();
    }
示例#8
0
 public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
 {
     spriteBatch.Begin();
     if (gameState == GameState.Playing)
     {
         spriteBatch.Draw(background, new Vector2(TetrisGame.ScreenSize.X / 2, 0), Color.White);//background van https://www.zedge.net/wallpaper/1d9b81a3-c7cc-38e8-a176-df7111aad04e
         grid.Draw(gameTime, spriteBatch);
         currentShape.Draw(gameTime, spriteBatch);
         nextShape.Draw(gameTime, spriteBatch);
         scoreDisplay(gameTime, spriteBatch);
     }
     if (gameState == GameState.GameOver)
     {
         gameOver(gameTime, spriteBatch);
     }
     spriteBatch.End();
 }
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        {
            Vector2 textLocationStart        = new Vector2(225, 260);
            Vector2 textLocationControls     = new Vector2(225, 300);
            Vector2 textLocationEnd          = new Vector2(400, 50);
            Vector2 textLocationScore        = new Vector2(400, 50);
            Vector2 textLocationLevel        = new Vector2(400, 80);
            Vector2 textLocationVolgendBlock = new Vector2(400, 110);

            switch ((int)gameState)
            {
            case 0:
                spriteBatch.Begin();
                spriteBatch.DrawString(font, "Press space to start!", textLocationStart, Color.Black);
                spriteBatch.DrawString(font, "Use A and D for left right, Q and E for rotation", textLocationControls, Color.Black);
                spriteBatch.End();

                break;

            case 1:
                spriteBatch.Begin();
                spriteBatch.DrawString(font, "Score: " + score, textLocationScore, Color.Black);
                spriteBatch.DrawString(font, "Level: " + level, textLocationLevel, Color.Black);
                spriteBatch.DrawString(font, "Volgend blok:", textLocationVolgendBlock, Color.Black);
                spriteBatch.DrawString(font, "y position: " + grid.getBlockPosition().Y, new Vector2(400, 350), Color.Black);
                grid.Draw(gameTime, spriteBatch);
                spriteBatch.End();
                break;

            case 2:
                spriteBatch.Begin();
                spriteBatch.DrawString(font, "Game Over: press Enter to return to start!", textLocationEnd, Color.Black);
                spriteBatch.End();
                break;

            default:
                break;
            }
        }
    }
示例#10
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();
        grid.Draw(gameTime, spriteBatch);
        spriteBatch.DrawString(font, "Score:", new Vector2(100, 0), Color.Blue);

        DrawBlocks(spriteBatch, this.block);

        grid.tijd++;
        if (NoCollision())
        {
            if (grid.tijd == 10)
            {
                block.Location.Y += 1;
                grid.tijd         = 0;


                //NoCollision();
            }
        }
        spriteBatch.End();
    }
示例#11
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();
        if (gameState == GameState.Title)
        {
            spriteBatch.DrawString(font, "Smash die linkermuisbutton om te starten!", new Vector2(100, 0), Color.Blue);
        }
        if (gameState == GameState.GameOver)
        {
            spriteBatch.DrawString(font, "Smash die linkermuisbutton om te opnieuw naar het beginscherm te gaan!", new Vector2(100, 0), Color.Blue);
        }
        if (gameState == GameState.Playing)
        {

            grid.Draw(gameTime, spriteBatch);
            spriteBatch.DrawString(font, "Score: " + score, new Vector2(0, 0 + 4 * grid.emptyCell.Height), Color.Blue);
            spriteBatch.DrawString(font, "Level: " + level, new Vector2(0, 40 + 4 * grid.emptyCell.Height), Color.Blue);
            DrawBlocks(spriteBatch);

            
        }
        spriteBatch.End();
    }
示例#12
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();
        grid.Draw(gameTime, spriteBatch);
        switch (chooseBlock.Current)
        {
        case 0:
            Iblok.Draw(gameTime, spriteBatch);
            break;

        case 1:
            Oblok.Draw(gameTime, spriteBatch);
            break;

        case 2:
            Tblok.Draw(gameTime, spriteBatch);
            break;

        case 3:
            Sblok.Draw(gameTime, spriteBatch);
            break;

        case 4:
            Zblok.Draw(gameTime, spriteBatch);
            break;

        case 5:
            Jblok.Draw(gameTime, spriteBatch);
            break;

        case 6:
            Lblok.Draw(gameTime, spriteBatch);
            break;
        }
        DrawText(score.ToString(), Vector2.Zero, spriteBatch);
        spriteBatch.End();
    }
示例#13
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        spriteBatch.Begin();

        switch (gameState)
        {
        case GameState.Start:
            spriteBatch.DrawString(font, "Startscherm", new Vector2(97, 0), Color.Blue);
            break;

        case GameState.Playing:
            drawGame();
            break;

        case GameState.GameMenu:
            drawGame();
            break;

        case GameState.GameOver:
            spriteBatch.DrawString(font, "Game Over", new Vector2(97, 4), Color.Blue);
            spriteBatch.DrawString(font, "Level = " + level, new Vector2(97, 34), Color.Blue);
            spriteBatch.DrawString(font, "Score = " + score, new Vector2(97, 64), Color.Blue);
            break;
        }

        spriteBatch.End();

        void drawGame()
        {
            grid.Draw(gameTime, spriteBatch);
            activeBlock.Draw(gameTime, spriteBatch, Vector2.Zero);
            queuedBlock.Draw(gameTime, spriteBatch, new Vector2(400, 100));
            spriteBatch.DrawString(font, "Score: " + score, new Vector2(500, 0), Color.Blue);
            spriteBatch.DrawString(font, "Level: " + level, new Vector2(500, 40), Color.Blue);
        }
    }
示例#14
0
    public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
    {
        if (gameState == GameState.Playing)
        {
            // if the video is supposed to be on (the user hasn't set it to false in the options menu) play the video, otherwise use
            // an alternative background
            if (videoison)
            {
                Texture2D videoframe = videoplayer.GetTexture();
                spriteBatch.Draw(videoframe, display, Color.White);
            }
            else
            {
                spriteBatch.Draw(alternativebackground, Vector2.Zero, Color.White);
            }
            // Draw the main playing grid, the HUD and the current block
            grid.Draw(gameTime, spriteBatch, block);
            // draw the bomb sprite if the block is indeed a bbomb
            if (newblock is BlockBOOM)
            {
                newblock.Draw(gameTime, spriteBatch, bombblock);
            }
            else
            {
                newblock.Draw(gameTime, spriteBatch, block);
            }
            hud.MainDraw(gameTime, spriteBatch, nextblock);
        }
        if (gameState == GameState.GameOver)
        {
            // if the game is over draw the HUD's gameover screen and the back button
            hud.GameOverScreen(gameTime, spriteBatch);
            Back.Draw(gameTime, spriteBatch);
        }
        if (gameState == GameState.Help)
        {
            // draw the help method and the back button
            hud.Help(gameTime, spriteBatch);
            Back.Draw(gameTime, spriteBatch);
        }
        if (gameState == GameState.Options)
        {
            // draw the background for the options menu
            hud.Options(gameTime, spriteBatch);
            // draw a button for the videoison button, which will be green if the video is on and red if it isn' t
            if (videoison)
            {
                Videobutton = new Button(videobuttonON, new Vector2(155, 250));
                Videobutton.Draw(gameTime, spriteBatch);
            }
            else
            {
                Videobutton = new Button(videobuttonOFF, new Vector2(155, 250));
                Videobutton.Draw(gameTime, spriteBatch);
            }
            // same for music, green if on, red if off.
            if (music)
            {
                Musicbutton = new Button(musicbuttonON, new Vector2(155, 130));
                Musicbutton.Draw(gameTime, spriteBatch);
            }
            else
            {
                Musicbutton = new Button(musicbuttonOFF, new Vector2(155, 130));
                Musicbutton.Draw(gameTime, spriteBatch);
            }
            // Draw the back button
            Back.Draw(gameTime, spriteBatch);
        }

        if (gameState == GameState.Menu)
        {
            // Draw the menu and the menu buttons
            hud.MenuScreen(gameTime, spriteBatch);
            Play.Draw(gameTime, spriteBatch);
            Options.Draw(gameTime, spriteBatch);
            Help.Draw(gameTime, spriteBatch);
            Back.Draw(gameTime, spriteBatch);
        }
    }