public static void Builder()
 {
     //String map = Properties.Resources.level1;
     win = false;
     Character.bulletnum = 0;
     String[] lines = map.Split('\n');
     width  = lines[0].Length - 1;
     height = lines.Length;
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             PictureSprite background = new PictureSprite(Properties.Resources.wall2, i * 100, j * 100);
             canvas.add(background);
         }
     }
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             if (lines[j][i] == 'g')
             {
                 goal = new Goal(i * 100, j * 100);
                 canvas.add(goal);
                 // Console.WriteLine("asdf");
             }
         }
     }
     for (int i = 0; i < width; i++)
     {
         for (int j = 0; j < height; j++)
         {
             if (lines[j][i] == 'w')
             {
                 Wall wall = new Wall(i * 100, j * 100);
                 canvas.csAdd(wall);
             }
         }
     }
     for (int j = 0; j < height; j++)
     {
         for (int i = 0; i < width; i++)
         {
             if (lines[j][i] == 'c')
             {
                 character       = new Character(i * 100, j * 100);
                 character.alive = true;
                 canvas.csAdd(character);
             }
         }
     }
     canvas.add(rect);
     canvas.add(text);
 }
Exemple #2
0
        static void Main()
        {
            PictureSprite background = new PictureSprite(Properties.Resources.Start, 100, 100);

            canvas.add(background);

            /*
             * for (int i=0;i<13;i++)
             * {
             *  for(int j=0;j<7; j++)
             *  {
             *      PictureSprite background = new PictureSprite(Properties.Resources.wall2, i* 100, j * 100);
             *      canvas.add(background);
             *  }
             * }
             * Goal goal = new Goal(1100, 500);
             * canvas.add(goal);
             * canvas.csAdd(character);
             * for (int i = 0; i < 13; i++)
             * {
             *  Wall wall = new Wall(i * 100, 0);
             *  canvas.csAdd(wall);
             *  wall = new Wall(i * 100, 600);
             *  canvas.csAdd(wall);
             * }
             * for (int i = 0; i < 7; i++)
             * {
             *  Wall wall = new Wall(0, i * 100);
             *  canvas.csAdd(wall);
             *  wall = new Wall(1200, i * 100);
             *  canvas.csAdd(wall);
             * }
             * //canvas.csAdd(Zerg);
             * enemyCount = 1;
             */
            Application.Run(new Program());

            /*
             * Application.EnableVisualStyles();
             * Application.SetCompatibleTextRenderingDefault(false);
             * Application.Run(new Form1());
             */
        }