error: "Typerror: 'bool' objects is not callable" in mu 1.0.3 (pygame)
error: "Typerror: 'bool' objects is not callable" in mu 1.0.3 (pygame)
我是 python 的新手,我正在尝试在 python 中制作游戏。我查看了此错误的其他一些帖子,但我不理解它们。这是我正在尝试的代码 运行:
if player_x == 1024 - scene_x_offset:
player_x = 0
current_scene += 1
update_scene()
player_x = scene_x_offset
def update_scene():
scene_width = SCENE_DATA[current_scene][0]
scene_height = SCENE_DATA[current_scene][1]
scene_map = SCENERY_MAPS[current_scene]
scene_x_offset = (8 - scene_width) / 2 * 128
scene_y_offset = (8 - scene_height) / 2 * 128
我收到错误消息:
文件“my_python_thingy.py”,第 295 行,在 game_loop 中
类型错误:'bool' 对象不可调用。
我遗漏了与我遇到的错误无关的不必要代码。
将不胜感激,特别是如果它的格式像我这样的菜鸟可以理解!
谢谢
从您给我们的代码中看不清楚,但错误很可能是由于某处有一个布尔变量(True 或 False)与您在出现错误。如果你有一个名为 update_scene
的布尔值,你应该重命名它或函数 update_scene()
.
我是 python 的新手,我正在尝试在 python 中制作游戏。我查看了此错误的其他一些帖子,但我不理解它们。这是我正在尝试的代码 运行:
if player_x == 1024 - scene_x_offset:
player_x = 0
current_scene += 1
update_scene()
player_x = scene_x_offset
def update_scene():
scene_width = SCENE_DATA[current_scene][0]
scene_height = SCENE_DATA[current_scene][1]
scene_map = SCENERY_MAPS[current_scene]
scene_x_offset = (8 - scene_width) / 2 * 128
scene_y_offset = (8 - scene_height) / 2 * 128
我收到错误消息: 文件“my_python_thingy.py”,第 295 行,在 game_loop 中 类型错误:'bool' 对象不可调用。
我遗漏了与我遇到的错误无关的不必要代码。
将不胜感激,特别是如果它的格式像我这样的菜鸟可以理解!
谢谢
从您给我们的代码中看不清楚,但错误很可能是由于某处有一个布尔变量(True 或 False)与您在出现错误。如果你有一个名为 update_scene
的布尔值,你应该重命名它或函数 update_scene()
.