Commit f79d9c01 by BellCodeEditor

save project

parent 378a089a
Showing with 11 additions and 4 deletions
...@@ -40,7 +40,8 @@ hero = [pygame.image.load('hero1.png'), ...@@ -40,7 +40,8 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'), pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')] pygame.image.load('hero5.png')]
my_font = pygame.font.Font("STKAITI.TTF") my_font = pygame.font.Font("STKAITI.TTF",18)
score_font = music.font.Font("score.wav")
index = 0 index = 0
y = 400 y = 400
jumpState = "runing" jumpState = "runing"
...@@ -51,7 +52,7 @@ time = 0 ...@@ -51,7 +52,7 @@ time = 0
gamestate = True gamestate = True
block_list =pygame.sprite.Group() # 创建精灵组 block_list =pygame.sprite.Group() # 创建精灵组
screen = 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -61,6 +62,7 @@ while True: ...@@ -61,6 +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
# 悟空造型 # 悟空造型
wukong = Player(hero[index]) wukong = Player(hero[index])
...@@ -116,7 +118,11 @@ while True: ...@@ -116,7 +118,11 @@ while True:
screen.blit(gameover, (400, 200)) screen.blit(gameover, (400, 200))
gamestate = False gamestate = False
else: else:
if sprite.rect.x + sprite.rect.width if sprite.rect.x + sprite.rect.width < wukong.rect.x:
# 刷新画面 score+=sprite.score
sprite.score = 0
if score>old_score:
score_sound.play()
old_score = score
pygame.display.update() pygame.display.update()
FPS.tick(60) 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