我正在用 Python 做 RogueLike 游戏,我使用 DungeonGenerator.py。在我的游戏中,我从 .txt 文件中读取了地牢。
问题是我无法将我用 DungeonGenerator.py 制作的地牢写在 .txt 文件上,因为它是一个字符串矩阵。
这是 DungeonGenerator.py 的结果示例:
我尝试:
return tiles
file = open ("Dungeon.txt", "w")
file.write(tiles)
file.close()
显然瓷砖不是字符串。
谢谢指教!