如何将 .tmx(平铺地图编辑器)文件导入到我的 XNA 项目中
我尝试将 .tmx(平铺地图编辑器)文件加载到我的项目中,但收到此错误:
无法自动检测用于“Level1.tmx”的导入程序 没有处理此文件类型的导入程序。指定在您的项目中处理此文件类型的导入程序。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
默认情况下,XNA 不加载该文件。
这里有一个用于 XNA 项目的完整 TMX 地图加载器
http://windowsphonedevelopments.com/tmx-map-loader-xna-1- 0/
TMX Map Loader XNA 是一个完整的 XNA 内容管道库,允许您加载和处理来自 TMX 源资源文件的数据,并在设计时将数据作为中间格式输出(输出到 .xnb 文件) )。
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 不支持 Tile Map Editor 文件。但是可以将它们加载到您的项目中。有关自定义加载程序的一些信息可以在这里找到:
http://nerdculture.org/2009/07/14/tiled-maps-for-xna-full-support-for-the-tiled-map-xml-specification/< /a>
这篇文章有点旧,所以我不确定它是否适用于最新版本的 XNA,但这绝对是一个很好的起点。
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.
我找到了你的问题&这个答案在寻找相同的东西时:
TiledSharp
A .NET C# library for importing Tiled TMXtile Map
https://github。 com/marshallward/TiledSharp
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
我发现了一个名为 XTiled 的工具,它可以从头到尾处理 .tmx 文件的加载和渲染。
这是网站:https://bitbucket.org/vinull/xtiled
作者提供的示例/教程:https://www.youtube.com/watch?v=qd0Yh50SPL4< /a>
使用 Tiled Sharp,我能够将 tmx 加载到内存中,但没有用于实际渲染图块的 api。你必须自己做这一切。
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.