Commit 130752e1 by BellCodeEditor

save project

parent 62c82cb3
Showing with 14 additions and 5 deletions
...@@ -34,7 +34,8 @@ t = 30 ...@@ -34,7 +34,8 @@ t = 30
aa=Block(bush,cacti,stone) aa=Block(bush,cacti,stone)
bg_x=0 bg_x=0
road_x=0 road_x=0
time=0
brock
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -92,10 +93,18 @@ while True: ...@@ -92,10 +93,18 @@ while True:
screen.blit(road, (lu_x, 500)) # 路 screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
if aa.rect.x <= 0-aa.rect.width: # 障碍物消失 time+=1
# 创建障碍物对象 if time>=0:
aa=Block(bush,cacti,stone) r =random.randint(0,100)
aa.rect.x -= 8 if r>40:
obstacle=Block(bush,cactr,stone)
block_list.add(obstacle)
time=0
for prop in block_list:
prop.rect.x-=8
streen.blit(prop.rect.x,prop.rect.y)
if prop.rect.x<=0-prop.rect.width:
prop.kill()
screen.blit(aa.image, (aa.rect.x, aa.rect.y)) screen.blit(aa.image, (aa.rect.x, aa.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