Commit 8583616c by BellCodeEditor

save project

parent 31769d7a
Showing with 14 additions and 8 deletions
...@@ -52,6 +52,7 @@ t = 30 ...@@ -52,6 +52,7 @@ t = 30
bg_x = 0 bg_x = 0
road_x = 0 road_x = 0
time = 0 time = 0
speed = 30
block_list = Group() block_list = Group()
...@@ -69,13 +70,14 @@ while True: ...@@ -69,13 +70,14 @@ while True:
jumpState = "up" jumpState = "up"
if jumpState == "walking": if jumpState == "walking":
if event.key == locals.K_PLUS: if event.key == locals.K_PLUS:
jumpState == "runing" jumpState = "runing"
if jumpState == "runing": if jumpState == "runing":
if e if event.key == locals.K_MINUS:
jumpState = "walking"
# 悟空造型 # 悟空造型
wukong = Player(hero[index]) wukong = Player(hero[index])
if jumpState == "runing": # 跑步状态下 if jumpState == "runing" or jumpState == "walking": # 跑步状态下
index += 1 index += 1
if index >= 5: if index >= 5:
index = 0 index = 0
...@@ -93,10 +95,15 @@ while True: ...@@ -93,10 +95,15 @@ while True:
wukong.rect.y = y wukong.rect.y = y
t += 2 t += 2
else: else:
jumpState = "runing" jumpState = "walking"
t =30 t =30
if jumpState == "walking":
speed = 30
elif jumpState == "runing":
speed = 65
else:
speed = 45
bg_x -= 2 bg_x -= 2
road_x -= 8 road_x -= 8
# 将背景图画上去 # 将背景图画上去
...@@ -124,5 +131,4 @@ while True: ...@@ -124,5 +131,4 @@ while True:
game_state = False game_state = False
# 刷新画面 # 刷新画面
display.update() display.update()
TIME().tick(60) TIME().tick(speed)
\ No newline at end of file
\ 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