예제 #1
0
        private void CreateAlien()
        {
            Point point = new Point();

            for (int i = 0; i < 3; i++)
            {
                Alien warper = null;
                switch (i)
                {
                case 0:
                {
                    for (int j = 0; j < 13; j++)
                    {
                        point  = new Point(70 + (120 * j), 0);
                        warper = new BlueSprite(this, point);
                        listAlien.Add(warper);
                        point  = new Point(70 + (120 * j), 100);
                        warper = new BlueSprite(this, point);
                        listAlien.Add(warper);
                    }
                    break;
                }

                case 1:
                {
                    for (int j = 0; j < 13; j++)
                    {
                        point  = new Point(70 + (120 * j), 200);
                        warper = new GreenSprite(this, point);
                        listAlien.Add(warper);
                        point  = new Point(70 + (120 * j), 300);
                        warper = new GreenSprite(this, point);
                        listAlien.Add(warper);
                    }
                    break;
                }

                case 2:
                {
                    for (int j = 0; j < 13; j++)
                    {
                        point  = new Point(70 + (120 * j), 400);
                        warper = new RedSprite(this, point);
                        listAlien.Add(warper);
                    }
                    break;
                }
                }
            }
        }
예제 #2
0
        private void CreateAlien()
        {
            Point point = new Point();  //实例化

            for (int j = 0; j < 3; j++)
            {
                Alien wraper = null;
                switch (j)
                {
                case 0:      // BlueSprite的添加
                {
                    for (int i = 0; i < 10; i++)
                    {
                        point  = new Point(50 + 150 * i, 0);
                        wraper = new BlueSprite(this, point);
                        listAlien.Add(wraper);
                        point  = new Point(50 + 150 * i, 70);
                        wraper = new BlueSprite(this, point);
                    }
                }
                break;

                case 1:             // RedSprite的添加
                {
                    for (int i = 0; i < 10; i++)
                    {
                        point  = new Point(50 + 150 * i, 140);
                        wraper = new RedSprite(this, point);
                        listAlien.Add(wraper);
                        point  = new Point(50 + 150 * i, 210);
                        wraper = new RedSprite(this, point);
                    }
                }
                break;

                case 2:              // GreenSprite的添加
                {
                    for (int i = 0; i < 10; i++)
                    {
                        point  = new Point(50 + 150 * i, 280);
                        wraper = new GreenSprite(this, point);
                        listAlien.Add(wraper);
                        point  = new Point(50 + 150 * i, 350);
                        wraper = new GreenSprite(this, point);
                    }
                }
                break;
                }
            }
        }