到目前为止的代码:http: //pastie.org/private/wcjqodm9pm66aorks9jp7w
运行代码时,我收到错误:
Traceback (most recent call last):
File "C:/Users/Tyler/Documents/Third Party Games/Python/RogueLike/RogueLike.py", line 224, in <module>
render_all()
File "C:/Users/Tyler/Documents/Third Party Games/Python/RogueLike/RogueLike.py", line 173, in render_all
object.draw()
File "C:/Users/Tyler/Documents/Third Party Games/Python/RogueLike/RogueLike.py", line 69, in draw
libtcod.console_put_char(con, self.x, self.y, self.char, libtcod.BKGND_NONE)
File "C:\Users\Tyler\Documents\Third Party Games\Python\RogueLike\libtcodpy.py", line 765, in console_put_char
_lib.TCOD_console_put_char(con, x, y, ord(c), flag)
ctypes.ArgumentError: argument 2: <class 'TypeError'>: Don't know how to convert parameter 2
问题似乎是第 69 行:
libtcod.console_put_char(con, self.x, self.y, self.char, libtcod.BKGND_NONE)
它不喜欢 self.x 或 self.y
我在第 213 行遇到了类似的问题:
player = Object(SCREEN_WIDTH/2, SCREEN_HEIGHT, "@", libtcod.white)
但是我设法通过将 SCREEN_WIDTH 和 SCREEN_HEIGHT 替换为它们的实际值而不是变量名来巧妙地修复它。
但是,我似乎无法以这种方式解决当前的问题。