Esempio n. 1
0
        public static void Load()
        {
            __GameObjects = new GameObject[40];

            for (int i = 0; i < __GameObjects.Length / 2; i++)
            {
                __GameObjects[i] = new Star(new Point(600, 15 + i * 27), new Point(5 + i, 25 - i), new Size(5, 5));
            }
            for (int i = __GameObjects.Length / 2; i < __GameObjects.Length / 2 + 1; i++)
            {
                __GameObjects[i] = new StarBase(new Point(300, 200), new Point(1, 1), new Size(200, 200));
            }
            for (int i = __GameObjects.Length / 2 + 1; i < __GameObjects.Length; i++)
            {
                __GameObjects[i] = new GameObject(new Point(600, 50 - i), new Point(15 - i, 25 - i), new Size(20, 20));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Логика создания объектов
        /// </summary>
        public static void Load()
        {
            try
            {
                __GameObjects = new GameObject[40];
                //Звездочки
                for (int i = 0; i < __GameObjects.Length / 2; i++)
                {
                    __GameObjects[i] = new Star(new Point(600, 15 + i * 27), new Point(5 + i, 25 - i), new Size(15, 15), false);
                }
                //Звездная база
                for (int i = __GameObjects.Length / 2; i < __GameObjects.Length / 2 + 1; i++)
                {
                    __GameObjects[i] = new StarBase(new Point(300, 200), new Point(1, 1), new Size(200, 200), true);
                }
                //Астероиды
                for (int i = __GameObjects.Length / 2 + 1; i < __GameObjects.Length; i++)
                {
                    __GameObjects[i] = new Asteroid(new Point(600, 50 - i), new Point(15 - i, 25 - i), new Size(30 + i, 40 + i), true);
                }

                __Bullet     = new Bullet(new Point(20, 200), new Point(5, 0), new Size(20, 20));
                __Ship       = new StarShip(new Point(20, 200), new Point(0, 0), new Size(50, 50), false);
                __EnergyTank = new EnergyTank(new Point(20, 400), new Point(0, 0), new Size(50, 50), false);

                //надпись подсчета очков
                __ScoreCount  = new LabelGame("Очков: ", new Point(450, 10));
                __EnergeCount = new LabelGame("Энергии: ", new Point(450, 50));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                MessageBox.Show("Приложение будет закрыто");
                Application.Exit();
            }
        }