Commit 775e63c2 by BellCodeEditor

auto save

parent 075c040d
Showing with 30 additions and 14 deletions
# 和你的小伙伴用列表讲讲桃园结义的故事,并说说这其中运用了哪些列表知识: import numpy as np
# 来,我给你起个头~ import random
# 从前啊,有三个bro,分别是:刘备、关羽、张飞... import pygame
bro1="关羽"
bro2="刘备" FONT_PX = 15
bro3="张飞" pygame.init()
bros=["刘备","关羽","张飞"] winSur = pygame.display.set_mode((500, 600))
bro1=["关羽",160,8.5] font = pygame.font.SysFont('fangsong', 20)
bro2=["刘备",161,9.1] bg_suface = pygame.Surface((500, 600), flags=pygame.SRCALPHA)
bro3=["张飞",166,8.3] pygame.Surface.convert(bg_suface)
bros[0]="关羽" bg_suface.fill(pygame.Color(0, 0, 0, 13))
bros[1]="刘备" winSur.fill((0, 0, 0))
print(bros) # 数字
\ No newline at end of file texts = [font.render(str(i), True, (0, 255, 0)) for i in range(10)]
colums = int(500 / FONT_PX)
drops = [0 for i in range(colums)]
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
exit()
pygame.time.delay(33)
winSur.blit(bg_suface, (0, 0))
for i in range(len(drops)):
text = random.choice(texts)
winSur.blit(text, (i * FONT_PX, drops[i] * FONT_PX))
drops[i] += 1
if drops[i] * 10 > 600 or random.random() > 0.95:
drops[i] = 0
pygame.display.flip()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment