Commit b42a23cd by BellCodeEditor

save project

parent 2de73d60
Showing with 16 additions and 6 deletions
...@@ -26,6 +26,8 @@ jump = "run" ...@@ -26,6 +26,8 @@ jump = "run"
t=30 t=30
road_x = 0 road_x = 0
background_x = 0 background_x = 0
time = 0
block_list = pygame.sprite.Group()
class Block(pygame.sprite.Sprite): class Block(pygame.sprite.Sprite):
def __init__(self,c,d,e): def __init__(self,c,d,e):
...@@ -62,9 +64,6 @@ while True: ...@@ -62,9 +64,6 @@ while True:
jump = "run" jump = "run"
t=30 t=30
if b.rect.x <= 0-b.rect.width:
b = Block(stone,cacti,apple)
b.rect.x -= 8
road_x -= 8 road_x -= 8
if road_x <= -1000: if road_x <= -1000:
...@@ -74,9 +73,20 @@ while True: ...@@ -74,9 +73,20 @@ while True:
if background_x <= -1000: if background_x <= -1000:
background_x = 0 background_x = 0
time += 1
if time >= 60:
time = 0
w = random.randint(0,50)
if w >= 20:
b = Block(stone,cacti,apple)
block_list.add(b)
#print(block_list))
for sprite in block_list:
sprite.rect.x -= 8
screen.blit(sprite.img,(sprite.rect.x , sprite.rect.y))
print(sprite.img)
if sprite.rect.x <= 0-sprite.rect.width:
sprite.kill()
......
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