Commit 134a4afd by BellCodeEditor

save project

parent 2389d947
Showing with 18 additions and 15 deletions
...@@ -51,24 +51,27 @@ while True: ...@@ -51,24 +51,27 @@ while True:
if jumpState == "runing": if jumpState == "runing":
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState = "up" jumpState = "up"
if jumpState == "up": # 起跳状态 wukong = Player(hero[index])
if t > 0:
y -= t
t -= 2
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 30:
y += t
t += 2
else:
jumpState = "runing"
t =30
wukong = hero[index]
if jumpState == "runing": # 跑步状态下 if jumpState == "runing": # 跑步状态下
index += 1 index += 1
if index >= 5: if index >= 5:
index = 0 index = 0
if gamestate == True:
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
wukong.rect.y = y
t -= 2
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 30:
y += t
wukong.rect.y = y
t += 2
else:
jumpState = "runing"
t =30
# 将背景图画上去 # 将背景图画上去
# 远处背景 # 远处背景
bg_x -= 1 bg_x -= 1
...@@ -79,7 +82,7 @@ while True: ...@@ -79,7 +82,7 @@ while True:
if road_x<=-1000: if road_x<=-1000:
road_x = 0 road_x = 0
screen.blit(road,(road_x,500)) # 路 screen.blit(road,(road_x,500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong.image, (150, y)) # 悟空
time += 1 time += 1
if time >= 60: if time >= 60:
r = random.randint(0,100) r = random.randint(0,100)
......
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