简体   繁体   中英

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

i`m trying to make a game , but this error happens with my collision def

thats the code:

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

then i put in the game loop this function

is_colliding = colisao(espeto_f1)

and when i execute , this happens :/

PS : Sorry for bad english , i`m learning the language , yet

It is very likely that player.collided is None, instead of a function/method. Please check that. This is the only thing I can guess with the details given.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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