Commit a2e05b9b by BellCodeEditor

save project

parent e4597f7d
Showing with 17 additions and 7 deletions
...@@ -29,9 +29,10 @@ a = 0 ...@@ -29,9 +29,10 @@ a = 0
jump="runing" jump="runing"
y=400 y=400
t=30 t=30
b=Block(stone,cacti,bush) block_list = pygame.sprite.Group()
road_x=0 road_x = 0
bg_x=0 bg_x = 0
time = 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -71,10 +72,18 @@ while True: ...@@ -71,10 +72,18 @@ while True:
if a>4: if a>4:
a=0 a=0
screen.blit(wukong, (150, y)) screen.blit(wukong, (150, y))
if b.rect.x<0-b.rect.width: time += 1
b=Block(stone,cacti,bush) if time >= 60:
screen.blit(b.image,(b.rect.x,b.rect.y)) time = 0
b.rect.x-=8 num = random.randint(0,50)
if num > 20:
b = Block(stone,cacti,bush)
block_list.add(b)
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