如果我只做 image.load('').convert_alpha(),我可以得到我所有的图像。当我尝试获得更多控制权时,Surface 简直要了我的命,我不知道该怎么办了。我需要帮助,拜托!!
import pygame, sys
pygame.init()
white = ((250,250,250))
black = ((0,0,0))
w = 800
h = 600
moveX = 0
moveY = 0
screen = pygame.display.set_mode((w,h))
pygame.display.set_caption('Paws')
background = pygame.image.load('C:/PythonImg/10121.jpg').convert()
clock = pygame.time.Clock()
Phil = pygame.image.load('C:/PythonImg/Phil_blob.png').convert_alpha()
Philpos = pygame.rect.Rect(0, 0, 400,300)
def Phil((Philpos), Phil):
screen.blit(Phil, (Philpos))
while pygame.display.get_init():
pygame.event.pump()
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.display.get_init() == False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
moveX = -10
elif event.key == pygame.K_RIGHT:
moveX = 10
elif event.key == pygame.K_UP:
moveY = -10
elif event.key == pygame.K_DOWN:
moveY = 10
if event.type == pygame.KEYUP:
moveX = 0
moveY = 0
Philpos.move_ip(moveX, moveY)
Philpos.clamp_ip(screen.get_rect())
screen.fill(black)
screen.blit(background, (0,0))
Phil(Philpos, Phil)
pygame.display.update()
clock.tick(30)
pygame.QUIT()
quit()
听到我最新的错误
Traceback (most recent call last):
File "C:\Python27\Paws.py", line 57, in <module>
Phil(Philpos, Phil)
File "C:\Python27\Paws.py", line 28, in Phil
screen.blit(Phil, (Philpos))
TypeError: argument 1 must be pygame.Surface, not function