Commit 39a94901 by BellCodeEditor

save project

parent 480304a6
Showing with 5 additions and 5 deletions
...@@ -20,7 +20,7 @@ hero = [pygame.image.load('hero1.png'), ...@@ -20,7 +20,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')] pygame.image.load('hero5.png')]
index = 0 index = 0
y = 300 y = 400
jumpState = "running" jumpState = "running"
t = 30 t = 30
bg_x = 0 bg_x = 0
...@@ -52,6 +52,7 @@ while True: ...@@ -52,6 +52,7 @@ while True:
t += 2 t += 2
else: else:
jumpState= "running" jumpState= "running"
t=30
sb = hero[index] sb = hero[index]
if jumpState == "running": if jumpState == "running":
index += 1 index += 1
...@@ -61,16 +62,15 @@ while True: ...@@ -61,16 +62,15 @@ while True:
# 将背景图画上去 # 将背景图画上去
#+++++++++ #+++++++++
bg_x -= 1 bg_x -= 1
if bg_x<=1000: if bg_x <= -1000:
bg_x = 0 bg_x = 0
screen.blit(background, (bg_x, 0)) screen.blit(background, (bg_x, 0))
road_x -= 8 road_x -= 8
if road_x<=-1000: if road_x <= -1000:
road_x = 0 road_x = 0
screen.blit(road, (0, 500)) screen.blit(road, (road_x, 500))
screen.blit(sb, (150, y)) screen.blit(sb, (150, y))
if rect.x <= 0-rect.width: if rect.x <= 0-rect.width:
obstacle = random.choice([bush,cacti,stone]) obstacle = random.choice([bush,cacti,stone])
rect = obstacle.get_rect() rect = obstacle.get_rect()
......
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