How do I import .tmx (Tile Map Editor) file into my XNA Project

10.8k views Asked by At

I tried to load a .tmx (Tile Map Editor) file into my project but I'm getting this error:

Cannot autodetect which importer to use for "Level1.tmx" There are no importers which handle this file type. Specify the importer that handles this file type in your project.

4

There are 4 answers

0
apiguy On

XNA does not support Tile Map Editor files by default. It is possible to load them into your project however. Some information about a custom loader can be found here:

http://nerdculture.org/2009/07/14/tiled-maps-for-xna-full-support-for-the-tiled-map-xml-specification/

The post is a bit old so I'm not certain it's going to work with the latest version of XNA, but it's definitely a good starting point.

0
Lawrence Li On

XNA does not load the file by default. There is a full TMX Map Loader for XNA projects located here http://windowsphonedevelopments.com/tmx-map-loader-xna-1-0/

TMX Map Loader XNA is a full XNA content pipeline library that allows you to load and process the data from the TMX source asset file and output the data as an intermediate format at design time (output to an .xnb file).

0
C. Tewalt On

I found a tool called XTiled which handles loading and rendering of .tmx files from start to finish.

Here's the website: https://bitbucket.org/vinull/xtiled Example/Tutorial from the author: https://www.youtube.com/watch?v=qd0Yh50SPL4

With Tiled Sharp, I was able to load the tmx into memory, but there is no api for actually rendering tiles. You have to do it all yourself.

0
Martin Olika On

i found your question & this answer while looking for the same thing:

TiledSharp

A .NET C# library for importing Tiled TMX tile maps

https://github.com/marshallward/TiledSharp