Commit 382d3be5 by BellCodeEditor

save project

parent 0a52884e
Showing with 17 additions and 9 deletions
......@@ -21,6 +21,8 @@ index = 0
t = 30
jumpState = 'runing'
y = 400
bg_x = 0
road_x = 0
obstable = random.choice([apple,stone,cacti])
rect = obstable.get_rect()
rect.x = 1000
......@@ -33,10 +35,8 @@ while True:
if event.type == locals.KEYDOWN:
if jumpState == 'runing':
if event.key == locals.K_SPACE:
jumpState = 'up'
if jumpState == 'up':
if jumpState == 'up':
if t > 0:
......@@ -51,14 +51,22 @@ while True:
else:
jumpState = 'runing'
t = 30
if jumpState == 'runing':
index += 1
if index >= 5:
index = 0
bg_x -= 1
if bg_x <= -1000:
bg_x = 0
road_x -= 8
if road_x <= -1000:
road_x = 0
wukong = hero[index]
index += 1
if index == 5:
index = 0
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
screen.blit(background, (bg_x, 0))
screen.blit(road, (road_x, 500))
screen.blit(wukong, (150,y))
if rect.x <= 0-rect.width:
obstable = random.choice([apple,stone,cacti])
......
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