public TiledTileLayer CreateTileLayer(string name, int width, int height, int[] data)
        {
            var layer = new TiledTileLayer(this, _graphicsDevice, name, width, height, data);

            _layers.Add(layer);
            return(layer);
        }
        public static CollisionGrid CreateGrid(this CollisionWorld world, TiledTileLayer tileLayer)
        {
            var data = tileLayer.Tiles
                .Select(t => t.Id)
                .ToArray();

            return world.CreateGrid(data, tileLayer.Width, tileLayer.Height, tileLayer.TileWidth, tileLayer.TileHeight);
        }
        public static CollisionGrid CreateGrid(this CollisionWorld world, TiledTileLayer tileLayer)
        {
            var data = tileLayer.Tiles
                       .Select(t => t.Id)
                       .ToArray();

            return(world.CreateGrid(data, tileLayer.Width, tileLayer.Height, tileLayer.TileWidth, tileLayer.TileHeight));
        }
Exemple #4
0
        public LayerData(TiledTileLayer layer)
        {
            Width = layer.Width;
            Height = layer.Height;
            List<int> ids = new List<int>();
            for (int y = 0; y < layer.Height; ++y)
            {
                for (int x = 0; x < layer.Width; ++x)
                {
                    var tile = layer.GetTile(x, y);
                    ids.Add(tile.Id);
                }
            }

            StringData = String.Join(",", ids.ToArray());
        }
 public TiledTileLayer CreateTileLayer(string name, int width, int height, int[] data)
 {
     var layer = new TiledTileLayer(this, _graphicsDevice, name, width, height, data);
     _layers.Add(layer);
     return layer;
 }