rendered paste body #region Draw
protected override void Draw(GameTime gameTime)
{
// Make the background Gray coloured
Graphics.GraphicsDevice.Clear(Color.Black);
#region Game is Running
if (IsGameRunning)
{
// Draw our player sprite
Player.Draw();
// Draw the bullets
if (BulletList.Count > 0)
{
foreach (Bullet bullet in BulletList)
{
bullet.Draw(gameTime);
}
}
// Draw the Enemy
if (EnemyList.Count > 0)
{
foreach (Enemy enemy in EnemyList)
{
enemy.Draw(gameTime);
}
}
Healthbar.Draw(gameTime);
// Draw the mouse
GetMouse.Draw();
Batch.Flush();
FontBatch.Begin(SpriteBlendMode.AlphaBlend);
// Draw how much time is left
DrawText.Blit(Graphics.PreferredBackBufferWidth - 560, 20, "Time left: " + ((int)TimeLimitLeft).ToString(), Color.White, DrawText.CourierNewLarge);
// Draw the level
DrawText.Blit(Graphics.PreferredBackBufferWidth - 360, 20, "Level: " + CurrentLevel.ToString(), Color.White, DrawText.CourierNewLarge);
// Draw the score
DrawText.Blit(Graphics.PreferredBackBufferWidth - 200, 20, "Score: " + Score.ToString(), Color.White, DrawText.CourierNewLarge);
FontBatch.End();
}
#endregion
else
#region End of Game
{
FontBatch.Begin(SpriteBlendMode.AlphaBlend);
if (WinGame)
DrawText.Blit(100, 80, "You win!", Color.Blue, DrawText.CourierNewLarge);
DrawText.Blit(100, 100, "You scored: " + Score, Color.Blue, DrawText.CourierNewLarge);
DrawText.Blit(100, 200, "Press ESCAPE to quit game.");
DrawText.Blit(100, 220, "Press ENTER to start a new game.");
FontBatch.End();
}
#endregion
FontBatch.Begin(SpriteBlendMode.AlphaBlend);
if (Paused)
DrawText.Blit(350, 150, "Paused", Color.White, DrawText.CourierNewLarge);
FontBatch.End();
FontBatch.Begin(SpriteBlendMode.AlphaBlend);
#region Debug code
/*DrawText.Blit(0, 0, "Enemy delay: " + Enemy.EnemyCreateDelay.ToString());
DrawText.Blit(0, 10, "Max bullet delay: " + Enemy.MaxBulletDelay.ToString());
DrawText.Blit(0, 20, "Min bullet delay: " + Enemy.MinBulletDelay.ToString());
DrawText.Blit(0, 30, "Enemy speed: " + Enemy.Speed.ToString());
DrawText.Blit(0, 40, "Enemy Bullet Speed: " + Bullet.EnemySpeed.ToString());
DrawText.Blit(0, 50, "Time till next level: " + TimeLimitLeft.ToString());
DrawText.Blit(0, 60, "Total time: " + TotalTimeElapsed.ToString());
DrawText.Blit(0, 70, "Is game over?: " + IsGameRunning.ToString());
DrawText.Blit(0, 80, "Player health: " + Player.CurHealth.ToString());
DrawText.Blit(0, 90, "Can die: " + Player.CanDie.ToString());*/
#endregion
FontBatch.End();
base.Draw(gameTime);
}
#endregion