我有以下代码为我的 roguelike 游戏渲染显示。它包括渲染地图。
def render_all(self):
for y in range(self.height):
for x in range(self.width):
wall = self.map.lookup(x,y).blocked
if wall:
self.main.addch(y, x, "#")
else:
self.main.addch(y, x, ".")
for thing in self.things:
draw_thing(thing)
每次都会出错。我认为这是因为它离开了屏幕,但是高度和宽度变量来自 self.main.getmaxyx(),所以它不应该那样做,对吧?我错过了什么?在 Ubuntu 14.04 中运行的 Python 3.4.3 应该很重要。