用户:
宇宙中的星系查看:3 回复:2 评论:3 创建时间:2023-08-12T15:06:36
【作品展示】

【作品介绍】
我不会弄动图,就干脆截了个图.........
【作品源代码】
import pygame
import random
pygame.init()
screen = pygame.display.set_mode([800, 600])
BLACK = (0,0,0)
keep_going = True
clors = [0] * 100
locations = [0] * 100
size = [0] * 100
for n in range(100):
clors[n] = (random.randint(0,255), random.randint(0,255), random.randint(0,255))
size[n] = random.randint(20,50)
locations[n] = (random.randint(0,800), random.randint(0,600))
while keep_going:
for event in pygame.event.get():
if event.type == pygame.QUIT:
keep_going = False
for n in range(100):
pygame.draw.circle(screen,clors[n], locations[n],size[n])
new_x = locations[n][0] + 1
new_y = locations[n][1] + 1
if new_x >= 800:
new_x -= 800
if new_y >= 600:
new_y -= 600
locations[n] = (new_x, new_y)
pygame.display.update()
screen.fill(BLACK)
pygame.quit()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn