请帮帮我,我有这个代码:
import sys, pygame
pygame.init()
size = width, height = 800, 600
speed = [2, 2]
black = 1, 1, 1
screen = pygame.display.set_mode(size)
ball = pygame.image.load("ball.bmp")
ballrect = ball.get_rect()
player1 = pygame.image.load("player1.png")
player1rect = player1.get_rect()
while 1:
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
ballrect = ballrect.move(speed)
if ballrect.left < 0 or ballrect.right > width:
speed[0] = -speed[0]
if ballrect.top < 0 or ballrect.bottom > height:
speed[1] = -speed[1]
player1rect = player1rect.move(speed)
if player1rect.w < 0 or player1rect.s > heght:
speed[1] = -speed[1]
screen.fill(black)
screen.blit(ball, ballrect) (player1, player1rect)
pygame.display.flip()
当我尝试启动它时,它只是说:
Traceback (most recent call last):
File "C:\Users\User\Documents\Pong\pong.py", line 31, in <module>
screen.blit(ball, ballrect) (player1, player1rect)
TypeError: 'pygame.Rect' object is not callable
那么有人可以帮助我吗?而且我几乎尝试了所有方法,但它不起作用,如果我的代码有更多问题,请写出来。
(对不起,我的英语不好)