Commit b39a5f11 by BellCodeEditor

save project

parent a71ff1f9
Showing with 11 additions and 2 deletions
......@@ -26,6 +26,7 @@ class Block(pygame.sprite.Sprite):
# 障碍物绘制坐标
self.rect.x = 1000
self.rect.y =500-self.rect.height
self.score=1
# 创建一个窗口
screen = pygame.display.set_mode((1000, 600))
......@@ -42,6 +43,8 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
score_audio=pygame.mixer.Sound('score.wav')
basic_font=pygame.font.Font('STKAITI.TTF',18)
block_list=pygame.sprite.Group() #Block=pygame.sprite.Group()
bgx=0
index = 0
......@@ -53,7 +56,7 @@ gamestate = True
# rect.x = 1000
# rect.y = 500 - rect.height
score=0
roadx=0
time=0
pygame.display.set_caption('悟空酷跑')
......@@ -126,7 +129,12 @@ while True:
gameover=pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
gamestate=False
else:
if(sprite.rect.x+sprite.rect.width)<wukong.rect.x:
score+=sprite.score
sprite.score=0
scoresurf=basic_font.render('分数:'+str(score),True,(216,126,77))
screen.blit(scoresurf,(660,20))
# 刷新画面
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