コード例 #1
0
ファイル: Game.cs プロジェクト: zorba77777/AsteroidsGame
        // Method draws all objects in the gamefield each tick of the timer
        public static void Draw()
        {
            Buffer.Graphics.Clear(Color.Black);

            foreach (Star star in _stars)
            {
                star?.Draw();
            }

            foreach (Asteroid asteroid in _asteroids)
            {
                asteroid?.Draw();
            }

            foreach (Bullet bul in _bullets)
            {
                bul.Draw();
            }

            _firstAidKit.Draw();
            _ship?.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, 70, 0);

            Buffer.Render();
        }
コード例 #2
0
        /// <summary>
        /// Рисование объектов, и вызов отрисовки в объектах
        /// </summary>
        public static void Draw()
        {
            Buffer.Graphics.Clear(Color.Black);

            foreach (BaseObject bs in _objs)
            {
                bs?.Draw();
            }
            foreach (Asteroid ast in _asteroids)
            {
                ast?.Draw();
            }
            foreach (Aid aid in _aids)
            {
                aid?.Draw();
            }

            _bullet?.Draw();
            _ship?.Draw();

            if (_ship != null)
            {
                Buffer.Graphics.DrawString($"Energy: {_ship.Energy}", SystemFonts.DefaultFont, Brushes.White, 0, 0);
                Buffer.Graphics.DrawString($"Score: {_ship.Score}", SystemFonts.DefaultFont, Brushes.White, 0, 20);
            }

            Buffer.Render();
        }
コード例 #3
0
ファイル: Game.cs プロジェクト: Sergei3190/MyGameHW
        /// <summary>
        /// метод вывода объектов в форму
        /// </summary>
        public static void Draw()
        {
            Buffer.Graphics.Clear(Color.Black);
            foreach (BaseObject obj in _objs)
            {
                obj.Draw();
            }
            foreach (Asteroid a in _asteroids)
            {
                a?.Draw();
            }
            foreach (Bullet b in _bullets)
            {
                b?.Draw();
            }
            pharmacy?.Draw();
            _ship?.Draw();

            if (_ship != null)
            {
                Buffer.Graphics.DrawString($"Energy: {_ship.Energy}", SystemFonts.DefaultFont, Brushes.White, 0, 0);
            }

            Buffer.Graphics.DrawString($"Shot down: {count}", SystemFonts.DialogFont, Brushes.White, 0, 20);

            Buffer.Render();
        }
コード例 #4
0
 public static void Draw()
 {
     Buffer.Graphics.Clear(Color.Black);
     foreach (BaseObject obj in _objs)
     {
         obj.Draw();
     }
     foreach (Asteroid a in _asteroids)
     {
         a?.Draw();
     }
     foreach (Bullet b in _bullets)
     {
         b.Draw();
     }
     _ship?.Draw();
     foreach (MedicalKit a in medkit)
     {
         a?.Draw();
     }
     if (_ship != null)
     {
         Buffer.Graphics.DrawString("HP:" + _ship.HP, SystemFonts.DefaultFont, Brushes.White, 20, 20);
     }
     Buffer.Render();
 }
コード例 #5
0
        static public void Draw()
        {
            buffer.Graphics.Clear(Color.Black);
            buffer.Graphics.DrawImage(background, 0, 0, Width, Height);

            foreach (BaseObject obj in objs)
            {
                obj.Draw();
            }

            foreach (Asteroids ast in asteroids)
            {
                if (ast != null)
                {
                    ast.Draw();
                }
            }

            foreach (AsteroidsBig astBig in asteroidsBig)
            {
                if (astBig != null)
                {
                    astBig.Draw();
                }
            }

            foreach (Nebula neb in nebula)
            {
                if (neb != null)
                {
                    neb.Draw();
                }
            }

            foreach (Bullet b in bullet)
            {
                if (b != null)
                {
                    b.Draw();
                }
            }

            foreach (Boss bss in boss)
            {
                if (bss != null)
                {
                    bss.Draw();
                }
            }

            ship.Draw();
            medkit.Draw();

            buffer.Graphics.DrawString("Health: " + ship.Health, SystemFonts.DefaultFont, Brushes.White, new Point(10, 10));
            buffer.Graphics.DrawString("Score: " + score, SystemFonts.DefaultFont, Brushes.White, new Point(80, 10));
            buffer.Graphics.DrawString("Wave: " + waveCount, SystemFonts.DefaultFont, Brushes.White, new Point(150, 10));
            buffer.Render();
        }
コード例 #6
0
 public static void Draw()
 {
     Buffer.Graphics.Clear(Color.Black);
     //foreach (BaseObject obj in objs)
     //    obj.Draw();
     foreach (Asteroid a in asteroids)
     {
         a?.Draw();
     }
     heal?.Draw();
     bullet?.Draw();
     ship?.Draw();
     if (ship != null)
     {
         Buffer.Graphics.DrawString("Energy:" + ship.Energy, SystemFonts.DefaultFont, Brushes.White, 0, 0);
     }
     Buffer.Render();
 }
コード例 #7
0
ファイル: Game.cs プロジェクト: dcd120/Game
        public static void Draw()
        {
            // Проверяем вывод графики
            //Buffer.Graphics.Clear(Color.Black);
            //Buffer.Graphics.DrawRectangle(Pens.White, new Rectangle(100, 100, 200,
            //200));
            //Buffer.Graphics.FillEllipse(Brushes.Wheat, new Rectangle(100, 100, 200,
            //200));
            //Buffer.Render();

            Buffer.Graphics.Clear(Color.Black);
            foreach (BaseObject obj in _objs)
            {
                obj?.Draw();
            }
            foreach (BaseObject obj in _asteroids)
            {
                obj?.Draw();
            }
            foreach (BaseObject obj in _heals)
            {
                obj?.Draw();
            }
            //_bullet?.Draw();
            foreach (Bullet b in _bullets)
            {
                b?.Draw();
            }

            _ship?.Draw();

            if (_ship != null)
            {
                Buffer.Graphics.DrawString("Energy:" + _ship.Energy + " Score:" + Score, SystemFonts.DefaultFont, Brushes.White, 0, 0);
            }

            // выведем надпись с инициалами
            Game.Buffer.Graphics.DrawString("by Nikolay Zarivnoy (c) 2018", myFont, Brushes.Aquamarine, 10, 20);

            Buffer.Render();
        }
コード例 #8
0
        /// <summary>
        /// Метед Draw отрисовывает кадр.
        /// </summary>
        public static void Draw()
        {
            Buffer.Graphics.Clear(Color.Black);


            foreach (BaseObject obj in _star)
            {
                obj.Draw();
            }
            foreach (BaseObject obj in _grayPlanet)
            {
                obj.Draw();
            }
            foreach (BaseObject obj in _redPlanet)
            {
                obj.Draw();
            }
            foreach (BaseObject obj in _asteroids)
            {
                obj?.Draw();
            }
            foreach (BaseObject obj in _fik)
            {
                obj.Draw();
            }
            foreach (Bullet b in _bullets)
            {
                b.Draw();
            }

            _ship?.Draw();

            if (_ship != null)
            {
                Buffer.Graphics.DrawString("Energy:" + _ship.Energy, SystemFonts.DefaultFont, Brushes.White, 0, 0);
                Buffer.Graphics.DrawString("Score:" + _ship.Score, SystemFonts.DefaultFont, Brushes.White, 60, 0);
            }


            Buffer.Render();
        }
コード例 #9
0
 public static void Timer_Tick(object sender, EventArgs e)
 {
     Clear();
     _medkit.Draw();
     _ship.Draw();
     Draw(_star);
     Draw(_bullets);
     Draw(_lasteroids);
     //Update(_lasteroids);
     Update(_star);
     Update();
     s.Draw();
     s.Update();
     _medkit.Update();
     if (_log != null)
     {
         _log("Статус");
         _log -= Hit;
         _log -= ShipHit;
     }
 }
コード例 #10
0
        /// <summary>
        /// Вывод через буфер на устройство вывода графики
        /// </summary>
        public static void Draw()
        {
            Buffer.Graphics.Clear(Color.Black);
            foreach (BaseObject obj in objectInSpace)
            {
                obj?.Draw();
            }

            foreach (Bullet b in bullets)
            {
                b.Draw();
            }

            ship?.Draw();
            if (ship != null)
            {
                Buffer.Graphics.DrawString($"Energy: {ship.Energy}", SystemFonts.DefaultFont, Brushes.White, 0, 0);
                Buffer.Graphics.DrawString($"Score: {ship.Score}", SystemFonts.DefaultFont, Brushes.White, 80, 0);
                Buffer.Graphics.DrawString($"Left goals: {objectInSpace.Count}", SystemFonts.DefaultFont, Brushes.White, 150, 0);
            }

            Buffer.Render();
        }
コード例 #11
0
ファイル: Game.cs プロジェクト: Cheefs/Asteroids
        /// <summary>
        /// Вывод всех обьектов на игровой экран
        /// </summary>
        public static void Draw()
        {
            Buffer.Graphics.Clear(Color.Black);
            _planets?.Draw();
            Interface();
            foreach (BaseObject obj in _objs)
            {
                obj.Draw();
            }
            foreach (Asteroid a in _asteroids)
            {
                a.Draw();
            }
            foreach (Bullet b in _bullets)
            {
                b.Draw();
            }

            _heal?.Draw();
            _ship?.Draw();
            try { Buffer.Render(); }
            catch { Application.Exit(); }
        }
コード例 #12
0
ファイル: Game.cs プロジェクト: Sodiv/CSharpLevel2
 /// <summary>
 /// Прорисовка в буфере и вывод на экран
 /// </summary>
 public void Draw()
 {
     Buffer.Graphics.Clear(Color.Black);
     foreach (BaseObject obj in _objs)
     {
         obj.Draw();
     }
     foreach (Asteroid ast in _asteroids)
     {
         ast?.Draw();
     }
     foreach (Bullet b in _bullets)
     {
         b.Draw();
     }
     _ship?.Draw();
     _heal?.Draw();
     if (_ship != null)
     {
         Buffer.Graphics.DrawString("Energy: " + _ship.Energy, SystemFonts.DefaultFont, Brushes.White, 0, 0);
     }
     Buffer.Render();
 }
コード例 #13
0
ファイル: Game.cs プロジェクト: xmishon/cs2
 /// <summary>
 /// Отрисовывает все элементы на сцене
 /// </summary>
 public static void Draw()
 {
     Buffer.Graphics.Clear(Color.Black);
     foreach (BaseObject obj in _objs)
     {
         obj.Draw();
     }
     foreach (BaseObject a in _asteroids)
     {
         a?.Draw();
     }
     foreach (BaseObject bullet in _bullets)
     {
         bullet?.Draw();
     }
     _ship?.Draw();
     _aid?.Draw();
     if (_ship != null)
     {
         Buffer.Graphics.DrawString("Energy: " + _ship.Energy, SystemFonts.DefaultFont, Brushes.White, 0, 0);
     }
     Buffer.Graphics.DrawString("Points: " + _points, SystemFonts.DefaultFont, Brushes.White, 400, 0);
     Buffer.Render();
 }