/// <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(); background.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(); bullets.Draw(spriteBatch); asteroids.Draw(spriteBatch); player.Draw(spriteBatch); alien.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(); for (int i = 0; i < lives; i++) { Sprite life = new Sprite(graphics, player.Image); life.Rotation = 0; life.size = 0.1f; life.position = new Vector2(10 + (i * 20), graphics.PreferredBackBufferHeight - 50); life.Draw(spriteBatch); } spriteBatch.End(); if (counter > 0) { spriteBatch.Begin(); spriteBatch.DrawString(font, "Wave " + wave, new Vector2(graphics.PreferredBackBufferWidth / 2 - 60, 200), Color.White * 0.7f); spriteBatch.End(); counter--; } spriteBatch.Begin(); if (lives < 0) { spriteBatch.DrawString(font, "GAME OVER!", new Vector2(200, graphics.PreferredBackBufferHeight / 2), Color.White); } spriteBatch.End(); base.Draw(gameTime); }