Commit b292f681 by BellCodeEditor

save project

parent a5009090
Showing with 11 additions and 3 deletions
......@@ -21,6 +21,8 @@ hero = [pygame.image.load('hero1.png'),
index = 0
y = 400
t = 30
road_x = 0
beijing_x = 0
jump = "running"
rect = cacti.get_rect()
rect.x = 1000
......@@ -55,8 +57,14 @@ while True:
if index == 5:
index = 0
# 将背景图画上去
screen.blit(background, (0, 0))
screen.blit(road, (0, 500))
beijing_x -= 4
if beijing_x <= -1000:
beijing_x = 0
screen.blit(background, (beijing_x, 0))
road_x -= 7
if road_x <= -1000:
road_x = 0
screen.blit(road, (road_x, 500))
screen.blit(wukong, (150, y))
if rect.x < 0-rect.width:
obstacle=random.choice([stone,cacti,apple])
......@@ -64,7 +72,7 @@ while True:
rect.x = 1000
rect.y = 455 - rect.width
else:
rect.x -= 8
rect.x -= 7
screen.blit(obstacle,(rect.x, rect.y))
# 刷新画面
pygame.display.update()
......
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