Commit 9769367d by BellCodeEditor

save project

parent 7074ca58
Showing with 8 additions and 3 deletions
......@@ -30,6 +30,7 @@ screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
pygame.display.set_caption("悟空酷跑")
# 载入图片
score_audio=pygame.mixer.Sound('score.wav')
background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路
stone = pygame.image.load('stone.png') # 石头
......@@ -44,13 +45,14 @@ basic_font=pygame.font.Font('STKAITI.TTF',17)
index = 0
y = 400
jumpState = "runing"
t = 30
t = 40
road_x = 0
bg_x = 0
time = 0
speed=8
gamestate = True
score=0
old_score=score
block_list =pygame.sprite.Group() # 创建精灵组
while True:
......@@ -79,13 +81,13 @@ while True:
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 30:
if t <= 40:
y += t
wukong.rect.y = y
t += 2
else:
jumpState = "runing"
t =30
t =40
# 将背景图画上去
bg_x -= 1
......@@ -120,6 +122,9 @@ while True:
if(sprite.rect.x+sprite.rect.width)<wukong.rect.x:
score+=sprite.score
sprite.score=0
if score>old_score:
score_audio.play()
old_score=score
#fenshu
scoreSulf=basic_font.render("分数:"+str(score),True,(123,111,111))
screen.blit(scoreSulf,(800,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