You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So that I can add static visual assets offgrid, I added an Object Layer and used the "T"-shortcut with on selected tiles.
You can see the result here:
For now, it is not possible to make MonoGame.Extended just render an object layer the same way a tile layer is rendered, although loading and manually accessing its content is pretty much identical.
So I wanted to manually spritebatch the objects.
When trying to identify the objects' source rectangles within their respective tilesheet, I noticed, that I am not able to access their global identifiers. Also, I noticed that the TilesMapTileReader does not populate the Tile property on the TiledMapTileObject which kind of seems like an issue to me.
Here is a little repro-solution (the assets being used are taken from one of the Kenney Game Asset Packs): ObjectLayerIssueRepro.zip
The text was updated successfully, but these errors were encountered:
Because the TiledMapTileReader can now populate the Tiled property of the TileMapTileObject objects, I can now retrieve their source rectangles and draw them properly
privatevoidDrawObjectLayer(SpriteBatchspriteBatch,TiledMaptiledMap){foreach(var obj in decorationLayer.Objects){if(obj is TiledMapTileObject tileObject){vartileset= tileObject.Tileset;varlocalIdentifier= tileObject.Tile.LocalTileIdentifier;vartileHeight= tileset.TileHeight;varsourceRectangle= tileset.GetTileRegion(localIdentifier);varposition=new Vector2(tileObject.Position.X, tileObject.Position.Y -tileHeight);
spriteBatch.Draw(tileset.Texture, position, sourceRectangle, Color.White);}}}
I used Tiled to create a tiled map.
So that I can add static visual assets offgrid, I added an Object Layer and used the "T"-shortcut with on selected tiles.
You can see the result here:
For now, it is not possible to make MonoGame.Extended just render an object layer the same way a tile layer is rendered, although loading and manually accessing its content is pretty much identical.
So I wanted to manually spritebatch the objects.
When trying to identify the objects' source rectangles within their respective tilesheet, I noticed, that I am not able to access their global identifiers. Also, I noticed that the TilesMapTileReader does not populate the Tile property on the TiledMapTileObject which kind of seems like an issue to me.
Here is a little repro-solution (the assets being used are taken from one of the Kenney Game Asset Packs):
ObjectLayerIssueRepro.zip
The text was updated successfully, but these errors were encountered: