为什么我 blit 图像时会出错

Why do I get an error when I blit an image

我正在尝试将敌人放入我正在制作的游戏中。但是当我 运行 项目 python 报告 'TypeError'

File "C:\Users\Zee_S\OneDrive\Desktop\python projects\lil Shooter\Player\Lil Shooter.py", line 153, in draw
    screen.blit(ZwalkRight[self.walkcount//3] (self.x, self.y))
TypeError: 'pygame.Surface' object is not callable
[Finished in 1.4s]

但我查看了我的代码,它看起来不错

class Enemy(object):

    ZwalkRight = [pygame.image.load('ZR1.png'), pygame.image.load('ZR2.png'),]
    ZwalkLeft = [pygame.image.load('ZL1.png'), pygame.image.load('ZL2.png'),]
        
    def __init__(self, x, y, width, height, end):
        self.x = x
        self.y = y
        self.width = width
        self.height = height
        self.end = end
        self.path = [self.x, self.end]
        self.walkcount = 0
        self.velo = 3

    def draw(self,win):
        self.move()
        if self.walkcount + 1 <= 33:
            self.walkcount = 0

        if self.velo > 0:
            screen.blit(self.ZwalkRight[self.walkcount//3] (self.x, self.y))
            walkcount += 1
        else:
            win.blit(self.ZwalkLeft[self.walkcount //3] (self.x, self.y))
            walkcount += 1
    def move(self):
        if self.velo > 0:
            if self.x +  self.velo < self.path[1]:
                self.x += self.velo
            else:
                self.velo = self.velo * -1
                self.walkcount = 0
        else:
            if self.x - self.vel > self.path[0]:
                self.x += self.velo
            else:
                self.velo = self.velo * -1
                self.walkcount = 0

问题不在于我忘了画图因为我这里有

def redrawGameWindow():
    screen.blit(bg, (0,-100))
    man.draw(screen)
    zombie.draw(screen)
    for bullet in bullets:
        bullet.draw(screen)
    pygame.display.update()

    
    pygame.display.update()

man = Player(300, 508, 64, 64)
zombie = Enemy(100, 508, 64, 64, 450)
bullets = []
run = True
while run:
     [...]

有人可以修复甚至解释为什么我收到此错误吗

您在调用 blit:

时的右方括号后缺少一个逗号

screen.blit(self.ZwalkRight[self.walkcount//3] (self.x, self.y))

screen.blit(self.ZwalkRight[self.walkcount//3], (self.x, self.y))