Beispiel #1
0
 /// <summary>
 /// Метод отрисовки объектов
 /// </summary>
 public static void Draw()
 {
     _background.Draw();
     foreach (Star s in _stars)
     {
         s.Draw();
     }
     foreach (Asteroid a in _asteroids)
     {
         a.Draw();
     }
     foreach (Planets p in _planets)
     {
         p.Draw();
     }
     _bullet.Draw();
     _ship.Draw();
     if (_ship != null)
     {
         Buffer.Graphics.DrawString("Energy:" + _ship.Energy, SystemFonts.CaptionFont, Brushes.Wheat, 0, 1060);
         Buffer.Graphics.DrawString("Shiled:" + _ship.Shield, SystemFonts.CaptionFont, Brushes.Wheat, 75, 1060);
     }
     _aids.Draw();
     Buffer.Render();
 }
Beispiel #2
0
 public static void Draw()
 {
     Buffer.Graphics.Clear(Color.Black);
     foreach (BaseObject obj in _objs)
     {
         obj.Draw();
     }
     foreach (Asteroid a in _asteroids)
     {
         a.Draw();
     }
     _bullet?.Draw();
     if (_ship != null)
     {
         Buffer.Graphics.DrawString("Energy: " + _ship.Energy, SystemFonts.DefaultFont, Brushes.White, 0, 0);
     }
     Buffer.Graphics.DrawString("Score: " + Score, SystemFonts.DefaultFont, Brushes.White, 0, 15);
     Buffer.Graphics.DrawString("Level: " + Level, SystemFonts.DefaultFont, Brushes.White, 0, 30);
     _ship.Draw();
     if (_medicine == null && rnd.Next(0, 50) < 10)
     {
         _medicine = new Medicine(new Point(rnd.Next(Width - 10), rnd.Next(0, Height)), new Point(10, 10), new Size(30, 30));
     }
     _medicine?.Draw();
     Buffer.Render();
 }
Beispiel #3
0
 /// <summary>
 /// Рисование объектов
 /// </summary>
 public static void Draw()
 {
     Buffer.Graphics.DrawImage(background, 0, 0);
     foreach (BaseObject obj in _objs)
     {
         obj.Draw();
     }
     foreach (var asteroid in _asteroids)
     {
         asteroid.Draw();
     }
     _bullet.Draw();
     Buffer.Render();
 }
Beispiel #4
0
 public static void Draw()
 {
     Buffer.Graphics.Clear(Color.Black);
     foreach (var baseObject in _objects)
     {
         baseObject.Draw();
     }
     foreach (var asteroid in _asteroids)
     {
         asteroid.Draw();
     }
     _bullet.Draw();
     Buffer.Render();
 }
Beispiel #5
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            int i;

            // Render the player's bullets
            for (i = 0; i < bullets.Length; i++)
            {
                Bullet b = bullets[i];

                if (b != null && b.isActive)
                {
                    b.Draw(spriteBatch);
                }
            }

            spriteBatch.Begin();
            {
                // Render the player's ship
                if (isActive)
                {
                    spriteBatch.Draw(ship_texture, position, null, Color.White, (float)rotation, origin, 1.0f, SpriteEffects.None, 0.0f);
                }

                // Render explosion
                particleRenderer.RenderEffect(explosionEffect);

                // Thrust Particles
                particleRenderer.RenderEffect(thrustEffect);

                // Render the HUD
                for (i = 0; i < lives; i++)
                {
                    spriteBatch.Draw(ship_texture, new Vector2(scoreRegion.X + (i * ship_texture.Width / 2) + (i * 10), scoreRegion.Y), null, Color.White, 0, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f);
                }
                spriteBatch.DrawString(font, "Score: " + score, new Vector2(scoreRegion.X, scoreRegion.Y + ship_texture.Height / 2), Color.White);
            }
            spriteBatch.End();
        }