Commit 0d1412d4 by BellCodeEditor

auto save

parent 080ee70a
Showing with 7 additions and 5 deletions
......@@ -10,8 +10,7 @@ pygame.display.set_caption("悟空酷跑")
# 载入图片
background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路
stone = pygame.image.load('stone.png') # 石头
cacti = pygame.image.load('cacti.png') # 仙人掌
stone = pygame.image.load('stone.png') # 石头=
bush = pygame.image.load('bush.png') # 灌木丛
hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero2.png'),
......@@ -26,7 +25,7 @@ obstacle = random.choice([bush, stone, cacti])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
dl=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -58,8 +57,11 @@ while True:
if index >= 5:
index = 0
# 将背景图画上去
screen.blit(background, (0, 0)) # 远处背景
screen.blit(road, (0, 500)) # 路
screen.blit(background, (0, 0))
dl-=8
if dl<1000:
dl=0 # 远处背景
screen.blit(road, (dl, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
if rect.x <= 0-rect.width: # 障碍物消失
......
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