猫史档案馆


【Python作品分享】飞翔的小鸟【求助帖】

用户:张嘉睿Zbym张嘉睿Zbym查看:0 回复:0 评论:0 创建时间:2020-08-06T12:59:50


【作品展示】

center_image

 

【作品介绍】

pygame

 

【作品源代码】

import pgzrun
import random
WIDTH = 350
HEIGHT = 600

bg = Actor("background")
bird = Actor("brid")
bird.x = 50
bird.y = HEIGHT/2
bar_up = Actor("bar_up")
bar_up.x = 300
bar_up.y = 0
bar_down = Actor("bar_down")
bar_down.x = 300
bar_down.y = 600

def draw():
    bg.draw()
    bird.draw()
    bar_up.draw()
    bar_down.draw()

def update():
    if bird.colorderect(bar_down):
        return
    bird.y = bird.y + 3
    bar_up.x = bar_up.x - 2
    bar_down.x = bar_down.x - 2

def on_mouse_down():
    bird.y = bird.y - 50

pgzrun.go()

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 0下一页