Commit ac5fa23f by BellCodeEditor

save project

parent 81fe4f6a
Showing with 10 additions and 2 deletions
......@@ -52,6 +52,7 @@ gamep="true"
block_list =pygame.sprite.Group()
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
......@@ -60,16 +61,24 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
wukong = P(hero[index])
if jumpState == "runing": # 跑步状态下
index += 1
if index >= 5:
index = 0
if gamep=="true":
if jumpState == "up": # 起跳状态
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"
......@@ -91,7 +100,6 @@ while True:
road_x = 0
screen.blit(road, (road_x, 500))
screen.blit(wukong.image, (150, y)) # 悟空
# 绘制障碍物
# if obstacle.rect.x <= 0-obstacle.rect.width:
# obstacle = Block(bush,cacti,stone)
......
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