用户:
勇敢小豆豆查看:0 回复:0 评论:0 创建时间:2022-06-04T12:35:01
【作品展示】

【作品介绍】
这个游戏戏使用海龟编辑器制作,使用了复杂难学的pygame第三方库。我要感谢一位编友,他在编程猫创作社区发布了一个用pygame制作的贪吃蛇,我本来已经想放弃了,但看到他做出这么好的程序,我就坚持学了下去。接下来来介绍一下玩法。关东鼠标滚轮几发子弹,每击中一次,靶标移动速度加快,共有5次脱把的机会。上方的变量代表分数,下方的变量代表余下的机会。我的最高分是13分。其中运用了blit,flip,image,rect,boder_radiuse,MOUSEWHEEL,colliderect等方法和函数
【作品源代码】
import pygame
import sys
from pygame.locals import *
import time
pygame.init()
def 喵():
for __count in range(200):
喵 = pygame.font.Font(None, 90)
喵r = 喵.render("Oh no", True, [255, 255, 255])
screen.blit(喵r, [0, 0])
pygame.display.flip()
def gameover():
hcr = pygame.image.load("E:\\段智杰\\火柴人.png")
for __count in range(1000):
screen.fill([255, 255, 255])
jw = pygame.font.Font(None, 70)
jwr = jw.render("Bey bey", True, [255, 0, 0])
screen.blit(jwr, [300, 50])
screen.blit(hcr, [300, 200])
pygame.display.flip()
sys.exit()
pygame.quit()
def ok():
for __count in range(200):
gd = pygame.font.Font(None, 90)
gdr = gd.render("Good!", True, [255, 255, 255])
screen.blit(gdr,[0,0])
pygame.display.flip()
wz = [0, 0,100,100]
sd = 0.2
cgb = 0
fs = 0
fsc = 0
喵 = "5"
喵c = 5
while 喵c > 0:
fs = str(fsc)
喵 = str(喵c)
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption(" 小小神箭手游戏")
f喵 = pygame.font.Font(None,70)
fsr = f喵.render(fs,True,[255,255,255])
喵b = pygame.font.Font(None, 70)
喵r = 喵b.render(喵, True, [255, 255, 255])
bb = pygame.draw.rect(screen, [255, 0, 0], wz, 0, border_radius=20)
wf = pygame.draw.rect(screen,[255,255,255],[400,500,20,100],0)
screen.blit(喵r,[700,40])
screen.blit(fsr, [700, 0])
pygame.display.flip()
for event in pygame.event.get():
if event.type == QUIT:
gameover()
if event.type == MOUSEWHEEL:
for __count in range(5):
zd = pygame.draw.rect(screen, [150, 150, 150],[400, 0, 20, 100], 0, border_radius=5)
pygame.display.flip()
if bb.colliderect(zd):
fsc +=1
sd +=0.07
ok()
wz = [0,0,100,100]
continue
else:
喵()
sd = 0.2
喵c -=1
fsc = 0
wz = [0, 0, 100, 100]
if bb.x > 800:
wz = [0,0,100,100]
喵()
else:
wz[0] += sd
for __count in range(1000):
bg = pygame.display.set_mode((800,600))
pygame.display.set_caption(" 小小神箭手游戏")
bg.fill([150,150,150])
go = pygame.font.Font(None,80)
gor = go.render("Game Over",True,[255,0,0])
bg.blit(gor,[200,300])
pygame.display.flip()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn