Commit e88ed63a by BellCodeEditor

save project

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