蓝大伟 发表于 2020-8-21 22:13:10

怎么了?

import pygame

pygame.init()

screen = pygame.display.set_mode((480,700))

bg = pygame.image.load("./images/background.png")

screen.blit(bg,(0,0))
#pygame.display.update()

f = pygame.image.load("./images/me1.png")
screen.blit(f, (200, 500))
pygame.display.update()

clock = pygame.time.Clock()
hero_rect = pygame.Rect(150,300,102,126)
while True:
    clock.tick(1)
    hero_rect -= 50
    screen.blit(f,hero_rect)
    pygame.display.update()
   
pygame.quit()


libpng warning: iCCP: known incorrect sRGB profile
Traceback (most recent call last):
File "C:/Users/tlan2/Desktop/真·飞机大战/01.py", line 20, in <module>
    hero_rect -= 50
TypeError: unsupported operand type(s) for -=: 'pygame.Rect' and 'int'

永恒的蓝色梦想 发表于 2020-8-21 22:22:28

你这个 -=50 是想干什么
页: [1]
查看完整版本: 怎么了?