Exemplo n.º 1
0
        // Load all bts tiles.
        private void LoadBtsTiles()
        {
            BlitImage tiles = new BlitImage(GraphicsIO.LoadBitmap(BtsTilesFile));
            BlitImage small = new BlitImage(GraphicsIO.LoadBitmap(BtsTilesSmallFile));

            // Load 16x16 tiles;
            BtsTiles.Clear();
            for (int y = 0; y > -tiles.Height; y -= 16)
            {
                for (int x = 0; x > -tiles.Width; x -= 16)
                {
                    BlitImage newTile = new BlitImage(16, 16);
                    newTile.Clear();
                    newTile.Blit(tiles, x, y, false, false);
                    BtsTiles.Add(newTile);
                }
            }

            // Load 8x8 tiles.
            BtsTilesSmall.Clear();
            for (int y = 0; y > -tiles.Height; y -= 8)
            {
                for (int x = 0; x > -tiles.Width; x -= 8)
                {
                    BlitImage newTile = new BlitImage(8, 8);
                    newTile.Clear();
                    newTile.Blit(small, x, y, false, false);
                    BtsTilesSmall.Add(newTile);
                }
            }
        }
Exemplo n.º 2
0
 // Read all enemy types from enemy folder.
 private void ReadEnemyTypes()
 {
     string [] paths = Directory.GetFiles(Environment.CurrentDirectory +
                                          EnemyFolder);
     for (int i = 0; i < paths.Length; i++)
     {
         var    newEnemy = new EnemyType();
         string filename = Tools.FilenameFromPath(paths [i]);
         Tools.TrimFileExtension(ref filename, out string extension);
         if (extension.ToLower() == ".png" && filename.Length > 5)
         {
             newEnemy.EnemyID  = Tools.HexToInt(filename.Substring(0, 4));
             newEnemy.Name     = filename.Substring(5, filename.Length - 5);
             newEnemy.Graphics = new BlitImage(GraphicsIO.LoadBitmap(paths [i]));
             EnemyTypes.Add(newEnemy);
         }
     }
     EnemyTypes.Sort((x, y) => x.EnemyID - y.EnemyID);
     for (int i = 0; i < EnemyTypes.Count; i++)
     {
         EnemyTypes [i].Index = i;
     }
 }