Commit a2e05b9b by BellCodeEditor

save project

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