Commit 59728c78 by BellCodeEditor

save project

parent 21aecfcc
Showing with 8 additions and 5 deletions
import pygame import pygame
from pygame import locals from pygame import locals
import random import random
...@@ -51,7 +51,7 @@ bg_x = 0 ...@@ -51,7 +51,7 @@ bg_x = 0
time = 0 time = 0
gamestate = True gamestate = True
score = 0 score = 0
oid_score = score old_score = score
block_list =pygame.sprite.Group() # 创建精灵组 block_list =pygame.sprite.Group() # 创建精灵组
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -62,7 +62,7 @@ while True: ...@@ -62,7 +62,7 @@ while True:
if jumpState == "runing": if jumpState == "runing":
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState = "up" jumpState = "up"
speed = 8 +score//3
# 悟空造型 # 悟空造型
wukong = Player(hero[index]) wukong = Player(hero[index])
if jumpState == "runing": # 跑步状态下 if jumpState == "runing": # 跑步状态下
...@@ -120,6 +120,9 @@ while True: ...@@ -120,6 +120,9 @@ while True:
if (sprite.rect.x + sprite.rect.width) < wukong.rect.x: if (sprite.rect.x + sprite.rect.width) < wukong.rect.x:
score += sprite.score score += sprite.score
sprite.score = 0 sprite.score = 0
if score > old_score:
score_audio.play()
old_score = score
scoreSurf = basic_font.render("分数:"+str(score),True,(0,120,100)) scoreSurf = basic_font.render("分数:"+str(score),True,(0,120,100))
screen.blit(scoreSurf,(880,20)) screen.blit(scoreSurf,(880,20))
......
{"第1名": 0, "第2名": 0, "第3名": 0} {"第1名": 5, "第2名": 4, "第3名": 2}
\ No newline at end of file \ 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