-2
如果我只做image.load('')。convert_alpha(),我就可以得到我所有的圖片。 當我嘗試獲得更多的控制權,表面只是殺了我,我不知道該怎麼做更多。我需要幫助,請!Pygame.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
謝謝!這已經殺了一段時間了。 –