用户:
真诚的皮皮蟹SdR_查看:1 回复:1 评论:1 创建时间:2022-07-14T13:27:24
【作品展示】

【作品介绍】
做的真好!
【作品源代码】
import pgzrun
import random
WIDTH = 350
HEIGHT = 600
background = Actor("background")
bar_up = Actor("bar_up")
bar_down = Actor("bar_up")
bird = Actor("bird")
bar_up.x = 300
bar_up.y = 600
bar_down.x = 300
bar_down.y = 100
bird.x = 50
bird.y = HEIGHT/2
score = 0
speed = 1
def draw():
background.draw()
bird.draw()
bar_down.draw()
bar_up.draw()
screen.draw.text(str(score), (30, 30), fontsize=50, color="green")
def update():
global score, speed
bird.y = bird.y + 2
bar_up.x = bar_up.x - 2
bar_down.x = bar_down.x - 2
if (bar_up.x < 0):
bar_up.x = WIDTH
bar_down.x = WIDTH
bar_up.y = random.randint(-200, 50)
bar_down.y = 600 + bar_up.y
score = score + 1
if score % 5 == 0:
speed = speed + 1
if (bird.colliderect(bar_up) or bird.colliderect(bar_down) or bird.y < 0 or bird.y > HEIGHT):
print('游戏失败')
bar_up.x = 300
bar_up.y = 600
bar_down.x = 300
bar_down.y = 100
bird.x = 50
bird.y = HEIGHT/2
score = 0
speed = 1
def on_mouse_down():
bird.y = bird.y - 50
pgzrun.go()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn