コード例 #1
0
ファイル: LevelOne.cs プロジェクト: sid365365/Galaxy
        /// <summary>
        ///   Initializes a new instance of the <see cref="LevelOne" /> class.
        /// </summary>
        public LevelOne()
        {
            // Backgrounds
            FileName = @"Assets\LevelOne.png";

            //// Enemies

            for (int i = 0; i < 5; i++)
            {
                var ship = new Ship(this);
                int positionY = ship.Height + 10;
                int positionX = 150 + i*(ship.Width + 50);
                ship.Position = new Point(positionX, positionY);
                Actors.Add(ship);
            }

            for (int i = 0; i < 1; i++)
            {
                var Thunderbolt = new Thunderbolt(this);
                int positionY = Thunderbolt.Height + 200;
                int positionX = 170 + i * (Thunderbolt.Width + 100);
                Thunderbolt.Position = new Point(positionX, positionY);
                Actors.Add(Thunderbolt);
            }
            for (int i = 0; i < 4; i++)
            {
                var ship2 = new Ship2(this);
                int positionY = ship2.Height + 50;
                int positionX = 170 + i * (ship2.Width + 100);
                ship2.Position = new Point(positionX, positionY);
                Actors.Add(ship2);
            }

            for (int i = 0; i < 3; i++)
            {
                var starOfDeathShip = new StarOfDeathShip(this);
                int positionY = starOfDeathShip.Height + 90;
                int positionX = 160 + i*(starOfDeathShip.Width + 120);
                starOfDeathShip.Position = new Point(positionX, positionY);
                Actors.Add(starOfDeathShip);
            }

            // Player
            Player = new PlayerShip(this);
            int playerPositionX = Size.Width/2 - Player.Width/2;
            int playerPositionY = Size.Height - Player.Height - 50;
            Player.Position = new Point(playerPositionX, playerPositionY);
            Actors.Add(Player);
        }
コード例 #2
0
ファイル: LevelOne.cs プロジェクト: shamanping/MyGelaxy
        /// <summary>
        ///   Initializes a new instance of the <see cref="LevelOne" /> class.
        /// </summary>
        public LevelOne()
        {
            //stopwatch
            m_stopwatch = new Stopwatch();
            m_stopwatch.Start();
              // Backgrounds
              FileName = @"Assets\LevelOne.png";

              // Enemies
              for (int i = 0; i < 5; i++)
              {
            var ship = new Ship(this);
            int positionY = ship.Height + 50;
            int positionX = 150 + i * (ship.Width + 50);

            ship.Position = new Point(positionX, positionY);

            ship.Check = i%2 == 0;

            Actors.Add(ship);
              }

            //=======
            //>>>>>>> parent of f10ca14... Revert "Создание нового класса врагов "Ultron" и добавление его на уровень"

              //Ultron
            var ultron = new Ultron(this);
            int ultronpositionY = ultron.Height + 90;
            int ultronpositionX = ultron.Width + 270;
            ultron.Position = new Point(ultronpositionX, ultronpositionY);
            Actors.Add(ultron);

              //Saboteur
              var thunderbolt = new Thunderbolt(this);
              int saboteurpositionY = Size.Height + 20;
              int saboteurpositionX = Size.Width;
              thunderbolt.Position = new Point(saboteurpositionX, saboteurpositionY);
              Actors.Add(thunderbolt);

            //<<<<<<< HEAD

              // Player
              Player = new PlayerShip(this);
              int playerPositionX = Size.Width / 2 - Player.Width / 2;
              int playerPositionY = Size.Height - Player.Height - 50;
              Player.Position = new Point(playerPositionX, playerPositionY);
              Actors.Add(Player);
        }