Python3.6“TypeError:blit的目标位置无效”

2024-05-16 07:10:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我有另一个Python错误,现在是TypeError。。。。。这是个错误

Traceback (most recent call last):
  File "C:/Users/dongjune/Desktop/PyCharm/PyFlying/PyFlying7.py", line 194, in 
<module>
initGame()
  File "C:/Users/dongjune/Desktop/PyCharm/PyFlying/PyFlying7.py", line 190, 
in initGame
    runGame()
  File "C:/Users/dongjune/Desktop/PyCharm/PyFlying/PyFlying7.py", line 146, in 
runGame
    drawObject(bat, bat_x, bat_y)
  File "C:/Users/dongjune/Desktop/PyCharm/PyFlying/PyFlying7.py", line 21, in 
drawObject
    gamepad.blit(obj, (x,y))
TypeError: invalid destination position for blit

这是drawObject

^{pr2}$

第145至154行:

        if not isShotBat:
               drawObject(bat, bat_x, bat_y)
          else:
               drawObject(boom, bat_x, bat_y)
               boom_count += 1
               if boom_count > 5:
                    boom_count = 0
                    bat_x = pad_width
                    bat_y = random.randrange
                    isShotBat = False

现在是runGame的顶端。。。在

    def runGame():
        global gamepad, aircraft, clock, background1, background2
        global bat, fires, bullet, boom


        isShotBat = False
        boom_count = 0

请修正这个错误!!!在


Tags: inpycountlineuserspycharmfiledesktop