用户:
天崩地裂邓昱辰查看:0 回复:0 评论:0 创建时间:2023-06-14T19:44:15
【作品展示】

【作品介绍】
wu
【作品源代码】
import pygame
import sys
pygame.init()
size = width,height = 1000,1000
screen = pygame.display.set_mode(size)
color = (0,0,0)
ball = pygame.image.load("ball.jpg")
ballrect = ball.get_rect()
speed = [5,5]
clock = pygame.time.Clock()
while True:
clock.tick(60)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
ballrect = ballrect.move(speed)
if ballrect.left < 0 or ballrect.right > width:
speed[0] = -speed[0]
if ballrect.top < 0 or ballrect.bottom > height:
speed[1] = -speed[1]
screen.fill(color)
screen.blit(ball,ballrect)
pygame.display.flip()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn