Commit 576951a8 by BellCodeEditor

save project

parent a20fbe30
Showing with 12 additions and 10 deletions
......@@ -43,8 +43,9 @@ hero = [pygame.image.load('hero1.png'),
#basic_font = pygame.font.Font('STKAITI.TTF',32)
index = 0
y = 400
score=0
jumpState = "runing"
t = 30
t = 4
road_x = 0
bg_x = 0
time = 0
......@@ -62,7 +63,7 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
speed=8+speed//3
speed=8+score//3
# 悟空造型
wukong = Player(hero[index])
if jumpState == "runing": # 跑步状态下
......@@ -75,17 +76,17 @@ while True:
if t > 0:
y -= t
wukong.rect.y = y
t -= 2
t -= 0.01
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 30:
if t <= 4:
y += t
wukong.rect.y = y
t += 2
t += 0.01
else:
jumpState = "runing"
t =30
t =4
# 将背景图画上去
bg_x -= 1
......@@ -93,7 +94,7 @@ while True:
bg_x = 0
screen.blit(background, (bg_x, 0)) # 远景
road_x -= 8
road_x -= speed
if road_x<=-1000:
road_x = 0
screen.blit(road, (road_x, 500)) # 道路
......@@ -117,10 +118,11 @@ while True:
screen.blit(gameover, (400, 200))
gamestate = False
else:
score+=1
score+=10
#scoreSurf = basic_font.render("分数:"+str(score),True,(255,0,0))
#screen.blit(scoreSurf,(850,20))
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
FPS.tick(60)
print(score)
\ 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