Commit e472173e by BellCodeEditor

save project

parent 0b8a18ac
Showing with 11 additions and 3 deletions
...@@ -26,6 +26,8 @@ obstacle=random.choice([stone,cacti,apple]) ...@@ -26,6 +26,8 @@ obstacle=random.choice([stone,cacti,apple])
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
dg_x=0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -60,10 +62,16 @@ while True: ...@@ -60,10 +62,16 @@ while True:
rect=obstacle.get_rect() rect=obstacle.get_rect()
rect.x=1000 rect.x=1000
rect.y=500-rect.height rect.y=500-rect.height
rect.x-=8 rect.x-=24
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (0, 0)) screen.blit(background, (dg_x, 0))
screen.blit(road, (0, 500)) road_x-=24
if road_x < -1000:
road_x=0
screen.blit(road, (road_x, 500))
dg_x-=22
if dg_x < -1000:
dg_x=0
screen.blit(wukong, (150, y)) screen.blit(wukong, (150, y))
screen.blit(obstacle, (rect.x, rect.y)) screen.blit(obstacle, (rect.x, rect.y))
# 刷新画面 # 刷新画面
......
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