用户:Jerry丶meta查看:0 回复:0 评论:0 创建时间:2020-11-29T11:08:55
【作品展示】

【作品介绍】
按下鼠标让小鸟飞起来吧碰到杆子或者上下边缘都会s
qwq一个氵作勿喷
【作品源代码】
import pgzrun
import random
import time
stop = 0
WIDTH = 350
HEIGHT = 600
bg = Actor("background")
bd = Actor("bird")
bd.x = 100
bd.y = 300
a1 = Actor("bar_down")
a1.x = 350
a1.y = random.randint(-100, 0)
a2 = Actor("bar_up")
a1.x = 350
a1.y = random.randint(600, 800)
def draw():
bg.draw()
bd.draw()
a1.draw()
a2.draw()
def update():
global stop
if bd.colliderect(a1) or bd.colliderect(a2) or bd.y < 0 or bd.y > 600:
stop = 1
return
bd.y += 2
a1.x -= 4
a2.x -= 4
if (a1.x < 0 or a2.x < 0):
a1.x = 350
a1.y = random.randint(-100, 0)
a2.x = 350
a2.y = a1.y+random.randint(600, 650)
def on_mouse_down():
if stop == 0:
for i in range(40):
bd.y -= 1
time.sleep(0.001)
pgzrun.go()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn