繁体   English   中英

TypeError:'NoneType'对象不可调用,我该如何解决?

[英]TypeError: 'NoneType' object is not callable , how can i solve it?

我正在尝试制作游戏,但是我的碰撞定义发生了此错误

多数民众赞成在代码:

def colisao(espeto):
   for b in range(len(espeto)) :
     if player.collided(espeto[b]):
        if b == 0 :
            espeto [0].x = janela.width / 2
            espeto [0].y = janela.height - espeto [0].height
        elif b == 1:
            espeto [b].y = janela.height - espeto [0].height
            espeto [b].x = espeto [0].x + janela.width / 3

        elif b != 1:
             espeto [b].y = janela.height - espeto [0].height
             espeto [b].x = janela.width / 2 + espeto [b - 1].x

然后我把这个功能放在游戏循环中

is_colliding = colisao(espeto_f1)

当我执行时,会发生这种情况:/

PS:对不起,英语不好,我正在学习英语,但是

player.collided很可能是None,而不是函数/方法。 请检查一下。 这是我唯一能猜出的细节。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM