TypeError:参数1必须是pygame.曲面,非内置函数_or_method,get_rec错误



下面是我正在处理的代码。我可以提供所有的代码,但在我输入之前一切都正常!从58、59、60号线开始

bd_surface = pygame.image.load('C:/Users/Documents/Python/Flappybird   Project/sprites/bluebird-midflap.png').convert
bd_surface = pygame.transform.scale2x(bd_surface)
bd_rect = bd_surface.get_rect(center = (100,512))

这是我的全部代码,以防万一

import pygame
import sys

#Have to define drawing the floor
def draw_fl():
screen.blit(fl_surface,(fl_x_pos,900))
screen.blit(fl_surface,(fl_x_pos + 576,900))
pygame.init()

#create display surface x= 560 and 1020 is y
screen = pygame.display.set_mode((576,1024))
clock = pygame.time.Clock()
#Flappy bird Variables
gravity = .25
bd_movement = 0
#background image
firstpng_surface = pygame.image.load('C:/Users/Documents/Python /Flappybird Project/sprites/background-day.png').convert()
firstpng_surface = pygame.transform.scale2x(firstpng_surface).convert()

fl_surface= pygame.image.load('C:/Users/Documents/Python/Flappybird    Project/sprites/base.png').convert()
fl_surface= pygame.transform.scale2x(fl_surface)
#floor x position
fl_x_pos = 0

bd_surface = pygame.image.load('C:/Users/Documents/Python/Flappybird    Project/sprites/bluebird-midflap.png').convert
bd_surface = pygame.transform.scale2x(bd_surface)
bd_rect = bd_surface.get_rect(center = (100,512))
while True:

for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()



#==moving the floor surface forward want to move it to the left
screen.blit(firstpng_surface,(0,0))

screen.blit(bd_surface,bd_rect)
fl_x_pos -=1
draw_fl()
if fl_x_pos <= -576:
fl_x_pos = 0


#draws on screen
pygame.display.update()
clock.tick(120)

错误消息第59行,inbd_surface=pygame.transform.scale2x(bd_surface(

TypeError:参数1必须是pygame。表面,非内置功能或方法

这是一个拼写错误。您错过了末尾的括号(()(

bd_surface = pygame.image.load('C:/Users/Documents/Python/Flappybird Project/sprites/bluebird-midflap.png').convert

bd_surface = pygame.image.load('C:/Users/Documents/Python/Flappybird    Project/sprites/bluebird-midflap.png').convert()

最新更新