Cannot convert from TiledMap to Texture2D (Tiled map editor)

Hi All,

You have probably seen me asking around just trying to get a tiled map to work with monogame.extended. I finally seem to have the .tmx map loaded into the content pipeline and loads into a variable (I can peek at all its attributes in VS during run time).

I can’t figure out a way to use it properly yet. I have tried spriteBatch.draw(tiledMap) but I get a conversion error.

I have tried an internal method I found tiledMap.Draw(), I placed it in the draw method and I get a NRE and tiledMap is now set to null (it initialised properly during load content looking at break points).

Any advice or pointers would be greatly appreciated.

UPDATE: I had an NRE because I declared my tiledMap in local scope of loadcontent() doh. Still, I have seen monogame extended demo games from the source repo and they use spriteBatch.draw(tiledMap)

This is a new feature in the develop branch. What version of MonoGame.Extended are you using?

Have you tried downloading the source repo and building it yourself?

No not yet but I will probably start doing it. Just using latest monogame exe installer and nuget package for extended.

Is this a bug? width and height in pixels not matching up.

I checked out extended source code and it is simply height * tileheight etc. Wondering why these two values get chopped down a little?

This was a bug in version 0.4 but it’s been fixed in 0.5.

The 0.5 NuGet package was published today.

Just updated to the 0.5, can confirm it now shows the correct values.