Commit cbaef8c7 by BellCodeEditor

save project

parent bf4e98c8
Showing with 16 additions and 1 deletions
...@@ -32,6 +32,8 @@ y = 400 ...@@ -32,6 +32,8 @@ y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
obstacle=Block(bush,cacti,stone) obstacle=Block(bush,cacti,stone)
time = 0
block_list=pygame.sprite.Group()
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -80,7 +82,19 @@ while True: ...@@ -80,7 +82,19 @@ while True:
obstacle.rect.x -= 8 obstacle.rect.x -= 8
time += 1
screen.blit(aa.image, (aa.rect.x, aa.rect.y)) screen.blit(aa.image, (aa.rect.x, aa.rect.y))
# 刷新画面 if time>=60:
time=0
num=random.randint(0,50)
if num > 20:
obstacle = Block(bush,cacti,stone)
block_list.add(obstacle)
for sprite in block_list :
sprite.rect.x -=8
screen.blit(sprite.image, (sprite.rect.x, sprite.rect.y)
if sprite.rect.x<=0-sprite.rect.width:
sprite.kill()
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