Ejemplo n.º 1
0
        ///
        /// Draws the scene to the spritebatch.
        ///
        /// <param name="spriteBatch">The target spritebatch.</param>
        public void Draw(SpriteBatch spriteBatch)
        {
            // Draw entities.
            paddle.Draw(spriteBatch);
            level.Draw(spriteBatch);
            foreach (Ball b in balls)
            {
                b.Draw(spriteBatch);
            }
            foreach (PowerUp PU in PowerUps)
            {
                PU.Draw(spriteBatch);
            }

            // Format and draw the display.
            string time = String.Format("Time: {0}:{1:D2}", (int)Math.Floor(timeLeft / 60), (int)timeLeft % 60);

            spriteBatch.DrawString(font, time, new Vector2(5, 4), (timeLeft < 60 && (int)timeLeft % 2 == 0) ? Color.DarkCyan : Color.LightBlue);

            string score = String.Format("Score: {0:D6}", player.Score);

            spriteBatch.DrawString(font, score, new Vector2(164, 4), Color.WhiteSmoke);

            string lives = String.Format("Lives: {0}", player.Lives);

            spriteBatch.DrawString(font, lives, new Vector2(370, 4), Color.Red);

            if (paused)
            {
                spriteBatch.DrawString(hsfont, "PAUSED", new Vector2(165, 180), Color.Red);
                spriteBatch.DrawString(font, "Press 'Space' to continue...", new Vector2(94, 224), Color.Red);
            }
        }
Ejemplo n.º 2
0
 public void Draw(SpriteBatch spriteBatch)
 {
     foreach (PowerUp PU in powerups)
     {
         PU.Draw(spriteBatch);
     }
 }