Esempio n. 1
0
        public TMXTileset(string name, int tileWidth, int tileHeight, int imageWidth, int imageHeight, string imagePath, int margin, int firstgid, int spacing, Dictionary <string, string> properties, Dictionary <string, string> tileProperties)
        {
            this.Name = name;

            this.TileWidth = tileWidth;

            this.TileHeight = tileHeight;

            this.ImageWidth = imageWidth;

            this.ImageHeight = imageHeight;

            this.ImagePath = imagePath;

            this.Margin = margin;

            this.FirstGrid = firstgid;

            this.Spacing = spacing;

            this.Properties = properties;

            this.TileProperties = tileProperties;

            Tiles = new TMXTile[(imageWidth / tileWidth * imageHeight / tileHeight) + 1];

            int i = 1;

            Tiles[i] = new TMXTile(0, 0, 0, 0, 0);

            for (int y = 0; y < imageHeight / tileHeight; y++)
            {
                for (int x = 0; x < imageWidth / tileWidth; x++)
                {
                    Tiles[i] = new TMXTile(i, x * tileWidth, y * tileHeight, tileWidth, tileHeight);

                    i++;
                }
            }
        }
Esempio n. 2
0
        public TMXTileset(string name, int tileWidth, int tileHeight, int imageWidth, int imageHeight, string imagePath, int margin, int firstgid, int spacing, Dictionary<string, string> properties, Dictionary<string, string> tileProperties)
        {
            this.Name = name;

            this.TileWidth = tileWidth;

            this.TileHeight = tileHeight;

            this.ImageWidth = imageWidth;

            this.ImageHeight = imageHeight;

            this.ImagePath = imagePath;

            this.Margin = margin;

            this.FirstGrid = firstgid;

            this.Spacing = spacing;

            this.Properties = properties;

            this.TileProperties = tileProperties;

            Tiles = new TMXTile[(imageWidth / tileWidth * imageHeight / tileHeight) + 1];

            int i = 1;
            Tiles[i] = new TMXTile(0, 0, 0, 0, 0);

            for (int y = 0; y < imageHeight / tileHeight; y++)
            {
                for (int x = 0; x < imageWidth / tileWidth; x++)
                {
                    Tiles[i] = new TMXTile(i, x * tileWidth, y * tileHeight, tileWidth, tileHeight);

                    i++;
                }
            }
        }