Example #1
0
        } // Update

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.White);
            spriteBatch.Begin();
            switch (gameState)
            {
            case GameState.Menu:
                spriteBatch.Draw(background, new Vector2(0, 0), Color.White);
                nyancat.draw(spriteBatch);
                player.draw(spriteBatch);
                bow.draw(spriteBatch);
                menu.draw(spriteBatch);

                if (!LoggedIn)
                {
                    spriteBatch.DrawString(font, "Login", new Vector2(0, 0), Color.Black, 0f, new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);
                }
                else
                {
                    spriteBatch.DrawString(font, "Logged in as " + username, new Vector2(0, 0), Color.Black, 0f, new Vector2(0, 0), 0.25f, SpriteEffects.None, 0);
                }

                break;

            case GameState.Target:
                spriteBatch.Draw(background, new Vector2(0, 0), Color.White);
                archeryTarget.draw(spriteBatch);
                nyancat.draw(spriteBatch);
                spriteBatch.DrawString(font, "Menu", new Vector2(0, 0), Color.Black, 0f,
                                       new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);
                spriteBatch.DrawString(font, "Score: " + targetModeScore, new Vector2(450, 0), Color.Black, 0f, new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);
                player.draw(spriteBatch);
                bow.draw(spriteBatch);
                menu.draw(spriteBatch);

                if (LoggedIn)
                {
                    spriteBatch.DrawString(font, "Logged in as " + username, new Vector2(128, 8), Color.Black, 0f, new Vector2(0, 0), 0.25f, SpriteEffects.None, 0);
                }
                break;

            case GameState.Bear:
                spriteBatch.Draw(background, new Vector2(0, 0), Color.White);
                nyancat.draw(spriteBatch);
                player.draw(spriteBatch);
                bow.draw(spriteBatch);
                menu.draw(spriteBatch);
                bearMode.draw(spriteBatch);

                if (LoggedIn)
                {
                    spriteBatch.DrawString(font, "Logged in as " + username, new Vector2(0, 0), Color.Black, 0f, new Vector2(0, 0), 0.25f, SpriteEffects.None, 0);
                }
                break;

            case GameState.GameOver:

                spriteBatch.DrawString(font, "Menu", new Vector2(0, 0), Color.Black, 0f,
                                       new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);

                spriteBatch.DrawString(font, "Game Over!", new Vector2(345, 0), Color.Black);

                spriteBatch.DrawString(font, bearMode.bearsKilled.ToString(),
                                       new Vector2(470, 80), Color.Red, 0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0);

                spriteBatch.DrawString(font, "bear(s) brutally murdered.",
                                       new Vector2(260, 160), Color.Black, 0f, new Vector2(0, 0), 0.6f, SpriteEffects.None, 0);

                if (nyancat.getIsDead())
                {
                    spriteBatch.DrawString(font, "(You also somehow managed to kill Nyan Cat, good job.)",
                                           new Vector2(255, 280), Color.Black, 0f, new Vector2(0, 0), 0.3f, SpriteEffects.None, 0);
                }

                spriteBatch.Draw(gameOverBear, new Vector2(0, 300), Color.White);

                if (isHighScore)
                {
                    spriteBatch.DrawString(font, "New High Score!",
                                           new Vector2(410, 220), Color.Red, 0f, new Vector2(0, 0), 0.4f, SpriteEffects.None, 0);
                }

                break;

            case GameState.Login:
                spriteBatch.Draw(background, new Vector2(0, 0), Color.White);
                nyancat.draw(spriteBatch);
                player.draw(spriteBatch);
                bow.draw(spriteBatch);
                menu.draw(spriteBatch);
                spriteBatch.DrawString(font, "Login", new Vector2(0, 0), Color.Black, 0f,
                                       new Vector2(0, 0), 0.5f, SpriteEffects.None, 0);
                break;
            }

            loginForm.Draw(spriteBatch, font);

            spriteBatch.Draw(crossHair, new Vector2(mousestate.X, mousestate.Y), Color.White);

            spriteBatch.End();

            base.Draw(gameTime);
        } // Draw