TypeError: draw_shape() missing 1 required positional argument: 'self'

TypeError: draw_shape() missing 1 required positional argument: 'self'

我正在尝试编写一个简单的乒乓球游戏代码作为学习的一种方式 pygame 因为我在编码方面经验不足。我最近才开始使用 类,我想我不太明白如何正确使用 init 正如每当我 运行 代码:

class ball:

    def __init__(self):
        self.y = y
        
    def draw_shape(self):
        
        pygame.draw.circle(screen, WHITE,(30 , self.y),15)
        pygame.display.flip()


while running:
    clock.tick(fps)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False
        if event.type == KEYDOWN and (event.key == K_UP):
            player.y = player.y + vel
    screen.fill(BLACK)
    visual.border_draw()
    visual.mid_lines()
    visual.score()
    ball.draw_shape()

我收到以下错误消息:

TypeError: draw_shape() missing 1 required positional argument: 'self'

尝试:

ball().draw_shape()

或者只是

player = ball()
player.draw_shape()