Commit ddf62192 by BellCodeEditor

save project

parent 080ee70a
Showing with 23 additions and 3 deletions
......@@ -27,6 +27,15 @@ rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
rc = road.get_rect()
rc.x = 0
rc.y = 500
rc2 = background.get_rect()
rc2.x = 0
rc2.y =0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -58,8 +67,9 @@ while True:
if index >= 5:
index = 0
# 将背景图画上去
screen.blit(background, (0, 0)) # 远处背景
screen.blit(road, (0, 500)) # 路
rect.x -= 8
screen.blit(background, (rc2.x, rc2.y)) # 远处背景
screen.blit(road,(rc.x, rc.y)) # 路
screen.blit(wukong, (150, y)) # 悟空
if rect.x <= 0-rect.width: # 障碍物消失
......@@ -68,7 +78,17 @@ while True:
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
rect.x -= 8
if rc.x <= 1000-rc.width:
rc = road.get_rect()
rc.x = 0
rc.y = 500
rc.x-=8
if rc2.x <= 1000-rc2.width:
rc2 = background.get_rect()
rc2.x = 0
rc2.y = 0
rc2.x-=1
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