用户:
兰镜嘉策(兰局兰段HXD3D-0177)查看:2 回复:1 评论:2 创建时间:2022-08-26T17:12:01
【作品展示】

【作品介绍】
请各位大佬看一下,怎么才能修复右键出了屏幕的BUG。
【作品源代码】
import pygame
pygame.init()
x, y = 195, 284
screen = pygame.display.set_mode((390, 566))
background = pygame.image.load('bg.png')
plane = pygame.image.load('plane.png')
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
x -= 20
if x < 0:
x = 0
if event.key == pygame.K_RIGHT:
x += 20
if x >= 390:
x = 390
screen.blit(background, (0, 0))
screen.blit(plane, (x, y))
pygame.display.update()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn