Commit 651f56b0 by BellCodeEditor

save project

parent c087d118
Showing with 17 additions and 7 deletions
...@@ -31,9 +31,9 @@ index = 0 ...@@ -31,9 +31,9 @@ index = 0
y = 400 y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
things = Block(bush,cacti,stone)
road_x = 0 road_x = 0
mountain_x = 0 mountain_x = 0
time = 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -82,15 +82,24 @@ while True: ...@@ -82,15 +82,24 @@ while True:
# things = Block(bush,cacti,stone) # things = Block(bush,cacti,stone)
# things.rect.x -= 8 # things.rect.x -= 8
block_list.add(things.image) time += 1
if time > 60:
num = random.randint(0,100)
if num >40:
things = Block(bush,cacti,stone)
block_list.add(things)
time = 0
for i in block_list: for i in block_list:
if things.rect.x < 0 - things.rect.width:
things.rect.x -= 8
i.rect.x -= 8
screen.blit(i.image, (i.rect.x, i.rect.y))
if i.rect.x < 0 - i.rect.width:
i.kill()
screen.blit(things.image, (things.rect.x, things.rect.y)) # screen.blit(things.image, (things.rect.x, things.rect.y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) 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