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)); }
protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); _bitmapFont = Content.Load <BitmapFont>("Fonts/courier-new-32"); _tiledMap = Content.Load <TiledMap>("Tilesets/level01"); _world = new CollisionWorld(new Vector2(0, 900)); _world.CreateGrid(_tiledMap.GetLayer <TiledTileLayer>("Tile Layer 1")); //var zombieAnimator = Content.Load<SpriteSheetAnimationGroup>("Sprites/zombie-animations"); //_zombie = new Zombie(zombieAnimator); //var zombieActor = _world.CreateActor(_zombie); //zombieActor.Position = new Vector2(462.5f, 896f); }