protected override void Draw(GameTime gameTime) { graphics.GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); //myBackground.Draw(spriteBatch); proceduralStarBackground.Draw(spriteBatch); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend); if (!gameOver) { Ship.Draw(spriteBatch); // Go through bullets, drawing each one int size = Bullets.Count; for (int i = 0; i < size; i++) { BulletObject curBullet = Bullets.Dequeue(); if (!TryHit(curBullet)) { curBullet.Draw(spriteBatch); Bullets.Enqueue(curBullet); } else { if (Ship.Health <= 0) { gameOver = true; } } } //destructibleObjects.DrawAll(spriteBatch); // Go through destructables, drawing each one int destSize = EnemyShips.Count; for (int i = 0; i < destSize; i++) { EnemyShip curDest = EnemyShips.Dequeue(); curDest.Draw(spriteBatch, enemy1); EnemyShips.Enqueue(curDest); } // Go through boons, drawing each one int boonSize = Boons.Count; for (int i = 0; i < boonSize; i++) { BoonObject curBoon = Boons.Dequeue(); curBoon.Draw(spriteBatch, boonTextures); Boons.Enqueue(curBoon); } DrawGUI(); } else { DrawText(new Vector2(MaxX / 2 - 50, MaxY / 2 - 10), "GAME OVER"); DrawText(new Vector2(MaxX / 2 - 85 - score.ToString().Length, MaxY / 2 + 10), "Final Score: " + score); } // FPS COUNTER -- DEBUG/OPTIMIZATION PURPOSES numOfFrames++; FPS = gameTime.ElapsedGameTime.Ticks; spriteBatch.DrawString(font, "FPS: " + FPS.ToString(), new Vector2(0, 40), Color.White); spriteBatch.End(); base.Draw(gameTime); }