首页 > 解决方案 > Python街机库函数read_tmx不起作用

问题描述

按照本教程中的此代码,我收到此错误

DeprecationWarning: The read_tmx function has been replaced by the new TileMap class.

我正在使用的代码是

game_map = arcade.tilemap.read_tmx(str(map_path))

我不确定这段代码现在是过时了还是什么,但我似乎无法找到让我的 tilemap 正确加载的方法。

标签: pythonarcade

解决方案


本教程建立在过时的Arcade版本上:

This tutorial uses Python 3.9 and arcade 2.5.5 throughout.

目前最新Arcade版本是2.6.1. 所以我在这里看到了几个选项:

  • Arcade将您的版本降级到2.5.5(虽然不推荐)
  • 将教程代码更新到最新Arcade版本
  • 使用官方 Arcade示例(最佳选择 imo)

推荐阅读