Commit 3aec7eb3 by BellCodeEditor

save project

parent c09afce4
Showing with 10 additions and 8 deletions
...@@ -34,7 +34,7 @@ t = 30 ...@@ -34,7 +34,7 @@ t = 30
bg_x=0 bg_x=0
road_x=0 road_x=0
time=0 time=0
block_list=pygame.sprite.Groap() block_list=pygame.sprite.Group()
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -81,13 +81,14 @@ while True: ...@@ -81,13 +81,14 @@ while True:
time+=1 time+=1
if time>=60: if time>=60:
r=random.randint(0,100) r=random.randint(0,100)
if r>40: if r > 40:
obstacle=Block(bush,cacti,stone) obstacle=Block(bush,cacti,stone)
time=0 block_list.add(obstacle)
for prop in block_list: time=0
prop.rect.x-=8 for prop in block_list:
screen.blit(prop.image, (prop.rect.x, prop.rect.y)) prop.rect.x -= 8
if prop.rect.x-=0-prop.rect.width: screen.blit(prop.image, (prop.rect.x, prop.rect.y))
prop.kill() if prop.rect.x <= 0-prop.rect.width:
prop.kill()
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
\ 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