用户:
神级人物帅哥查看:0 回复:0 评论:0 创建时间:2022-04-17T17:15:48
【作品展示】

【作品介绍】
不开
【作品源代码】
import pgzrun
WIDTH = 600
HEIGHT = 600
hole = Actor('虫洞')
hole.x = 30
hole.y = 100
barrier = Actor('障碍物')
barrier.x = 100
barrier.y = 300
barrier1 = Actor('障碍物1')
barrier1.x = 500
barrier1.y = 50
ship = Actor('战舰')
ship.x = 400
ship.y = 200
airboat = Actor('飞船')
airboat.x = 0
airboat.y = 200
airboat2 = Actor('飞船2')
airboat2.x = 0
airboat2.y = 450
def draw():
screen.blit('太空', [0, 0])
hole.draw()
ship.draw()
barrier.draw()
barrier1.draw()
airboat.draw()
airboat2.draw()
def update():
ship.y += 5
if keyboard.space:
ship.y -= 10
if keyboard.left:
ship.x -= 5
if keyboard.right:
ship.x += 5
airboat.x += 3
if airboat.x > 600:
airboat.x = 0
airboat2.x += 5
if airboat2.x > 600:
airboat2.x = 0
if ship.colliderect(airboat):
ship.image = '破损的战舰'
if ship.colliderect(airboat2):
ship.image = '破损的战舰'
pgzrun.go()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn