protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Black); spriteBatch.Begin(); spriteBatch.Draw(background, new Rectangle(0, 0, 1350, 700), Color.Gray); spriteBatch.Draw(_nasa, new Rectangle(10, 10, 120, 105), Color.White); rocket.Draw(spriteBatch); cosmonaut1.Draw(spriteBatch); cosmonaut2.Draw(spriteBatch); cosmonaut3.Draw(spriteBatch); asteroid.Draw(spriteBatch); asteroid2.Draw(spriteBatch); asteroid3.Draw(spriteBatch); asteroid4.Draw(spriteBatch); asteroid5.Draw(spriteBatch); asteroid6.Draw(spriteBatch); spriteBatch.Draw(_control, new Rectangle(1210, 20, 120, 80), Color.Gray); spriteBatch.Draw(_B, new Rectangle(1220, 110, 50, 50), Color.Gray); spriteBatch.Draw(_M, new Rectangle(1270, 110, 50, 50), Color.Gray); string stringCosm = $"Cosmonauts: {cosm}"; spriteBatch.DrawString(textCosm, stringCosm, new Vector2(140, 10), Color.WhiteSmoke); // вывод очков string stringHP = $"HP: {HP}"; spriteBatch.DrawString(textHP, stringHP, new Vector2(420, 10), Color.Red); // вывод жизней if (HP < 1) // Конец игры { spriteBatch.Draw(background, new Rectangle(0, 0, 1350, 700), Color.Black); spriteBatch.DrawString(gameOver, "GAME OVER", new Vector2(520, 300), Color.Red); } spriteBatch.End(); base.Draw(gameTime); }
public override void Draw(GameTime gameTime) { //spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, Game1.globalTransformation); bg.Draw(gameTime); flock.draw(gameTime); foreach (Player p in players) { p.Draw(gameTime); } DrawText(); if (Rocket.rocketFlying) { _rocket.Draw(gameTime); } //DrawSmoke(); _explosion.Draw(gameTime); //spriteBatch.End(); base.Draw(gameTime); }