How do I import .tmx (Tile Map Editor) file into my XNA Project
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. Sp开发者_Go百科ecify the importer that handles this file type in your project.
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).
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.
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
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.
精彩评论