Commit f7f642a5 by BellCodeEditor

save project

parent db11b5bd
Showing with 12 additions and 10 deletions
......@@ -40,7 +40,8 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
basic_font = pygame.font.Font('score.wav',32)
basic_font = pygame.font.Font('STKAITI.TTF',32)
score_audio=pygame.mixer.Sound('score.wav')
index = 0
y = 400
jumpState = "runing"
......@@ -50,6 +51,7 @@ bg_x = 0
time = 0
gamestate = True
score=0
sreen=8
block_list =pygame.sprite.Group() # 创建精灵组
while True:
......@@ -61,7 +63,7 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
sreen=8+score//3
# 悟空造型
wukong = Player(hero[index])
if jumpState == "runing": # 跑步状态下
......@@ -87,12 +89,12 @@ while True:
t =30
# 将背景图画上去
bg_x -= 1
bg_x -= sreen
if bg_x<=-1000:
bg_x = 0
screen.blit(background, (bg_x, 0)) # 远景
road_x -= 8
road_x -= sreen
if road_x<=-1000:
road_x = 0
screen.blit(road, (road_x, 500)) # 道路
......@@ -119,9 +121,9 @@ while True:
if sprite.x+sprite.rect.width<wukong.rect.x:
score+=sprite.score
sprite.score=0
text = basic_font.render("分数:"+str(score),True,(255,255,255))
screen.blit(text,(850,20))
text =basic_font.render("分数:"+str(score),True,(255,255,255))
screen.blit(text,(850,20))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment