Commit 4425f6e2 by BellCodeEditor

save project

parent bc0c538d
Showing with 6 additions and 4 deletions
File added
...@@ -14,6 +14,7 @@ class Block(pygame.sprite.Sprite): # 障碍物精灵类 ...@@ -14,6 +14,7 @@ class Block(pygame.sprite.Sprite): # 障碍物精灵类
# 障碍物绘制坐标 # 障碍物绘制坐标
self.rect.x = 1000 self.rect.x = 1000
self.rect.y = 500 - self.rect.height self.rect.y = 500 - self.rect.height
self.state = 1
class Player(pygame.sprite.Sprite): # 悟空 class Player(pygame.sprite.Sprite): # 悟空
def __init__(self, image): def __init__(self, image):
...@@ -40,7 +41,7 @@ hero = [pygame.image.load('hero1.png'), ...@@ -40,7 +41,7 @@ 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')]
# basic_font = pygame.font.Font() basic_font = pygame.font.Font("STKAITI.TTF",25)
index = 0 index = 0
y = 400 y = 400
jumpState = "runing" jumpState = "runing"
...@@ -117,10 +118,11 @@ while True: ...@@ -117,10 +118,11 @@ while True:
screen.blit(gameover, (400, 200)) screen.blit(gameover, (400, 200))
gamestate = False gamestate = False
else: else:
if sprite.rect.x < wukong.rect.x and score = 1: if sprite.rect.x < wukong.rect.x and sprite.state == 1:
score += 1 score += 1
score = 0 sprite.state = 0
scoreSurf = basic_font.render("分数:"+str(score),Ture,(250,230,1))
scoreSurf = basic_font.render("分数:"+str(score),True,(250,230,1))
screen.blit(scoreSurf,(850,20)) screen.blit(scoreSurf,(850,20))
# 刷新画面 # 刷新画面
......
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