用户:
申浩南查看:0 回复:0 评论:0 创建时间:2021-05-17T17:25:46
【作品展示】

【作品介绍】
之前标签打错中国发射了冥王星的人造卫星,点击鼠标可切换状态
【作品源代码】
#已尽量避免屏蔽词,若出现“喵”则是屏蔽词
#链接:https://pan.喵/s/1PzywdpE5w喵QsYeJGknViw 提取码:9999
import time
import pygame
from random import*
pygame.init()
screen = pygame.display.set_mode([960,720])
loadimg = pygame.image.load
pygame.display.set_caption('冥王星的人造卫星')
xianshiping = loadimg('xianshiping.png')
bg = loadimg('bg.png')
dq = loadimg('a.png')
喵 = loadimg('亮灯.png')
earth = loadimg('earth.png')
people=loadimg('人.png')
fashe=loadimg('发射.png')
喵fs=loadimg('发射卫星.png')
bg3=loadimg('bg3.png')
fsj=loadimg('发射架.png')
Pluto = loadimg('Pluto.png')
many_people = loadimg('一群人.png')
喵X = (-100)
喵Y = (-100)
red = 255,0,0
black = 0,0,0
white = 255,255,255
darkblue = 37,67,82
whiteblue = 171,227,255
yellow = 255,247,0
green = 0,255,13
pink = 255,0,251
cyan = 0,128,128
level = 0
fourfs=0
喵fsY=100
def event_loop():
# 游戏事件循环
for event in pygame.event.get():
if event.type == pygame.QUIT:
# 结束窗口
pygame.quit()
def drawwords(word,font,size,x,y,color):
font = pygame.font.SysFont(font,size)
text = font.render(word, True, color)
screen.blit(text,(x,y))
while True:
event_loop()
# 开始
if level == 0:
drawwords('庆祝中国共'+'产党建立100周年','SimHei',60,100,560,red)
screen.blit(dq, (0, 0))
drawwords('1921.7.23-2021.7.23','SimHei',35,300,660,red)
for e in range(30):
event_loop()
pygame.display.update()
time.sleep(0.1)
level = 1
# 第一组
if level == 1:
for n in range(200):
event_loop()
screen.fill(black)
screen.blit(earth, (680,100))
screen.blit(喵, (喵X, 喵Y))
screen.blit(xianshiping, (0, 0))
screen.blit(bg, (0, 0))
screen.blit(people, (300,280))
drawwords('模拟画面'+str(n), 'SimHei', 30, 0, 0, white)
喵X += n/18
喵Y += n/20
if n==199:
drawwords('单击鼠标以继续>>', 'SimHei', 25, 730, 680, black)
pygame.display.update()
one_two=True
while one_two:
for event in pygame.event.get():
if event.type==pygame.QUIT:
pygame.quit()
if event.type==pygame.MOUSEBUTTONDOWN:
one_two=False
level = 2
if level==2:
for t in range(2000):
event_loop()
screen.fill(darkblue)
if t>200:
if t<400:
drawwords('此时', 'SimHei', 100, (1200-t*(1200/400)), 0, whiteblue)
else:
drawwords('此时', 'SimHei', 100, 0, 0, whiteblue)
if t > 400:
if t < 600:
drawwords('中国科研人员', 'SimHei', 130,(1200-(t-200)*(1200/400)), 150, yellow)
else:
drawwords('中国科研人员', 'SimHei', 130, 0, 150, yellow)
if t > 600:
if t < 800:
drawwords('正在进行', 'SimHei', 100,(1200-(t-400)*(1200/400)), 300, red)
else:
drawwords('正在进行', 'SimHei', 100,0, 300, red)
if t >800:
if t < 1000:
drawwords('发射冥王星卫星', 'SimHei', 100,(1200-(t-600)*(1200/400)), 400, white)
else:
drawwords('发射冥王星卫星', 'SimHei', 100, 0, 400, white)
if t > 1000:
if t < 1200:
drawwords('并向宇宙发射中国喵的信号', 'SimHei', 50,(1200-(t-800)*(1200/400)), 500, pink)
else:
drawwords('并向宇宙发射中国喵的信号', 'SimHei', 50, 0, 500, pink)
if t > 1200:
if t < 1400:
drawwords('的研究', 'SimHei', 100,(1200-(t-1000)*(1200/400)), 580, cyan)
else:
drawwords('的研究', 'SimHei', 100, 0, 580, cyan)
pygame.display.update()
drawwords('单击鼠标以继续>>', 'SimHei', 25, 730, 680, white)
pygame.display.update()
two_three = True
while two_three:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
if event.type == pygame.MOUSEBUTTONDOWN:
two_three = False
level=3
if level==3:
for t in range(800):
event_loop()
screen.fill(darkblue)
if t > 200:
if t < 400:
drawwords('终于', 'SimHei', 300,(1200-t*(1200/400)), 0, yellow)
else:
drawwords('终于', 'SimHei',300, 0, 0, yellow)
if t > 400:
if t < 600:
drawwords('中国研制出了', 'SimHei', 50,(1200-(t-200)*(1200/400)), 350, green)
else:
drawwords('中国研制出了', 'SimHei', 50, 0, 350, green)
if t > 600:
if t < 600:
drawwords('1/4光速人造卫星', 'SimHei', 100,(1200-(t-400)*(1200/400)), 450, red)
else:
drawwords('1/4光速人造卫星', 'SimHei', 100, 0, 450, red)
pygame.display.update()
drawwords('单击鼠标以继续>>', 'SimHei', 25, 730, 680, white)
pygame.display.update()
three_four = True
while three_four:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
if event.type == pygame.MOUSEBUTTONDOWN:
three_four = False
level=4
if level==4:
if fourfs==0:
screen.fill(black)
screen.blit(喵fs,(200,100))
screen.blit(fsj,(450,100))
screen.blit(bg3,(0,0))
screen.blit(fashe,(370,390))
pygame.display.update()
a=True
while a:
event_loop()
for event in pygame.event.get():
if event.type==pygame.MOUSEBUTTONDOWN:
if abs(400-pygame.mouse.get_pos()[0]) <= 250 and abs(400-pygame.mouse.get_pos()[1]) <= 280:
a=False
fourfs = 1
else:
for i in range (200):
event_loop()
screen.fill(yellow)
screen.blit(喵fs,(200,喵fsY))
screen.blit(fsj,(450,100-喵fsY*10))
screen.blit(bg3,(0,0))
screen.blit(fashe,(370,390))
pygame.display.update()
喵fsY -= 5
for i in range (2000):
event_loop()
Temporary_color = randint(0, 255), randint(0, 255), randint(0, 255)
screen.fill(Temporary_color)
drawwords('飞行中(加速)', 'SimHei', 100, 200, 200,green)
pygame.display.update()
drawwords('单击鼠标以继续>>', 'SimHei', 25, 730, 680, white)
pygame.display.update()
four_five = True
while four_five:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
if event.type == pygame.MOUSEBUTTONDOWN:
four_five = False
level=5
喵X=0
喵Y=0
if level==5:
for i in range (100):
event_loop()
screen.fill(black)
screen.blit(Pluto,(350,300))
screen.blit(喵,(喵X,喵Y))
喵X += 5
喵Y += 5
pygame.display.update()
for i in range(50):
event_loop()
screen.fill(black)
screen.blit(Pluto,(350,300))
screen.blit(喵,(喵X,喵Y))
pygame.draw.circle(screen,white,(喵X,喵Y),i*15,5)
pygame.display.update()
drawwords('单击鼠标以继续>>', 'SimHei', 25, 730, 680, white)
pygame.display.update()
five_six = True
while five_six:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
if event.type == pygame.MOUSEBUTTONDOWN:
five_six = False
level = 6
if level == 6:
event_loop()
screen.fill(darkblue)
screen.blit(bg,(0,0))
drawwords('地球·北京时间1921年7月23日,是中国共'+'产党建立的日子,到现在已100年了。','SimHei',20,0,0,white)
drawwords('————来自冥王星附近','SimHei', 20, 0, 75, white)
drawwords('July 23, 1921, Beijing time, is the day when the Communist Party of China was founded, and it has been 100 years now.',\
'SimHei',15,0,150,white)
drawwords('-From near Pluto', 'SimHei', 20, 0, 200, white)
screen.blit(xianshiping,(0,0))
screen.blit(many_people,(0,300))
pygame.display.update()
drawwords('单击鼠标以退出↓↓', 'SimHei', 25, 730, 680, black)
pygame.display.update()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
if event.type == pygame.MOUSEBUTTONDOWN:
pygame.quit()
pygame.display.update()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn