Commit c64cdb1a by BellCodeEditor

save project

parent 4ba4ed5f
Showing with 14 additions and 3 deletions
...@@ -26,6 +26,11 @@ obstacle = random.choice([bush,cacti,stone]) ...@@ -26,6 +26,11 @@ obstacle = random.choice([bush,cacti,stone])
rect = obstacle.get_rect() rect = obstacle.get_rect()
rect.x = 1000 rect.x = 1000
rect.y = 500-rect.height rect.y = 500-rect.height
road_x = 0
road_y = 500
bg_x = 0
bg_y = 0
while True: while True:
...@@ -56,12 +61,18 @@ while True: ...@@ -56,12 +61,18 @@ while True:
if index > 4: if index > 4:
index = 0 index = 0
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) if bg_x <= -1000:
screen.blit(road, (0, 500)) bg_x = 0
bg_x -= 1
screen.blit(background, (bg_x, bg_y))
if road_x <= -1000:
road_x = 0
road_x -= 8
screen.blit(road, (road_x, road_y))
screen.blit(hero[index], (150, y)) screen.blit(hero[index], (150, y))
if rect.x < 0 - rect.width: if rect.x < 0 - rect.width:
obstacle = random.choicee([bush,cacti,stone]) obstacle = random.choice([bush,cacti,stone])
rect = obstacle.get_rect() rect = obstacle.get_rect()
rect.x = 1000 rect.x = 1000
rect.y = 500-rect.height rect.y = 500-rect.height
......
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