Commit f79d9c01 by BellCodeEditor

save project

parent 378a089a
Showing with 12 additions and 5 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')]
my_font = pygame.font.Font("STKAITI.TTF")
my_font = pygame.font.Font("STKAITI.TTF",18)
score_font = music.font.Font("score.wav")
index = 0
y = 400
jumpState = "runing"
......@@ -51,7 +52,7 @@ time = 0
gamestate = True
block_list =pygame.sprite.Group() # 创建精灵组
screen = 0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -61,7 +62,8 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
speed = 8 + score
# 悟空造型
wukong = Player(hero[index])
if jumpState == "runing": # 跑步状态下
......@@ -116,7 +118,11 @@ while True:
screen.blit(gameover, (400, 200))
gamestate = False
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()
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