Commit 9fea37c4 by BellCodeEditor

save project

parent 5771b4d4
Showing with 26 additions and 6 deletions
......@@ -31,7 +31,10 @@ jumpstate='running'
t=30
road_x=8
bg_x=0
obstacle=Block(stone,cacti,bush)
time=0
# obstacle=Block(stone,cacti,bush)
block_list=pygame.sprite.Group()
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -61,21 +64,37 @@ while True:
index=0
if y < 400 and y>150:
wukong=hero[3]
bg_x-=260
bg_x-=1
if bg_x <=-1000:
bg_x=0
road_x-=8
if road_x<=-1000:
road_x=0
time+=1
if time>=60:
time=0
num=random.randint(0,100)
if num>=40:
obstacle=Block(bush,stone,cacti)
block_list.add(obstacle)
time=0
for prop in block_list:
prop.rect.x-=8
screen.blit(prop.image,(prop.rect.x,prop.rect.y))
if prop.rect.x<=0-prop.rect.width:
prop.kill()
# 将背景图画上去
screen.blit(background, (bg_x, 0))
screen.blit(road, (road_x, 500))
screen.blit(wukong, (150, y))
screen.blit(obstacle.image,(obstacle.rect.x,obstacle.rect.y))
obstacle.rect.x-=8
#screen.blit(.image,(prop.rect.x,prop.rect.y))
# obstacle.rect.x-=8
if obstacle.rect.x <=0-obstacle.rect.width:
obstacle=Block(bush,stone,cacti)
# if obstacle.rect.x <=0-obstacle.rect.width:
# obstacle=Block(bush,stone,cacti)
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ No newline at end of file
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