如何解决screen.blit 功能在 pygame 中不起作用
import pygame,sys
WINDOW_SIZE = (900,700)
screen = pygame.display.set_mode(WINDOW_SIZE,32)
pygame.display.set_caption('Pygame Program')
pygame.display.set_icon(pygame.image.load('spaceship (3).png'))
player_img = pygame.image.load('ClipartKey_738895_adobespark.png')
player_X = 130
player_Y = 750
def player():
screen.blit(player_img,(player_X,player_Y))
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
sys.exit()
screen.fill((0,200,255))
player()
pygame.display.update()
我的 player() 函数不起作用。 它没有显示任何错误,但屏幕保持空白,没有显示任何内容
解决方法
坐标 (130,750) 位于窗口的底部外侧。更改 y 坐标。例如:
player_Y = 750
player_Y = 150
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。