Пример #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)
        {
            spriteBatch.Begin();
            GraphicsDevice.Clear(Color.DarkGray);

            if (state == GameState.GameOver)
            {
                spriteBatch.DrawString(font, "Game Over!", new Vector2(500, 250), Color.Black);
                spriteBatch.DrawString(font, "Press R to restart", new Vector2(500, 200), Color.Black);
            }
            if (state == GameState.Game)
            {
                //Draws score text and game over text
                spriteBatch.DrawString(font, "Score: " + Score, new Vector2(100, 100), Color.Black);
                spriteBatch.DrawString(font, "Lifes: " + Ship.HealthPoints, new Vector2(100, 50), Color.Black);
                //Draws every sprite
                foreach (Sprite sprite in sprites)
                {
                    sprite.Draw(spriteBatch);
                }
            }
            if (state == GameState.Menu)
            {
                menu.Draw(spriteBatch);
            }
            spriteBatch.End();
            base.Draw(gameTime);
        }
Пример #2
0
 public static void MenuDraw(SpriteBatch spriteBatch)
 {
     background.Draw(spriteBatch);
     menu.Draw(spriteBatch);
 }
Пример #3
0
 public static void MenuDraw(SpriteBatch spriteBatch)
 {
     menu.Draw(spriteBatch);
     spriteBatch.Draw(menuSprite, menuPos, Color.White);
 }
 public static void MenuDraw(SpriteBatch spriteBatch)
 {
     background.Draw(spriteBatch);
     menu.Draw(spriteBatch);             // Draw menu with Update method in menu object
 }