Commit b38035f5 by BellCodeEditor

save project

parent 16663e79
Showing with 8 additions and 2 deletions
......@@ -42,6 +42,7 @@ road_x = 0
bg_x=0
obstacle=Black(bush,stone,cacti)
time=0
gamestate = True
block_list=pygame.sprite.Group()
while True:
for event in pygame.event.get():
......@@ -52,10 +53,12 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
if gamestate == True:
wukong = Player(hero[index])
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
wukong.rect.y = y
t -= 2
else:
jumpState = "down"
......@@ -69,7 +72,7 @@ while True:
t =30
# 悟空造型
wukong = Player(hero[index])
if jumpState == "runing": # 跑步状态下
index += 1
if index >= 5:
......@@ -86,6 +89,7 @@ while True:
screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong.image, (150, y)) # 悟空
if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失
# 创建障碍物对象
obstacle=Black(bush,stone,cacti)
time += 1
......@@ -104,6 +108,7 @@ while True:
gameover = pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
gamestate = False
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ 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