Commit 47390c05 by BellCodeEditor

save project

parent 3db3fab9
Showing with 9 additions and 8 deletions
......@@ -35,7 +35,7 @@ class Block(pygame.sprite.Sprite):
self.rect.x=1000
self.rect.y=500-self.rect.height
obstacle=Block(bush,stone,cacti)
sprite_list=pygame.sprite.Group()
block_list=pygame.sprite.Group()
time=0
while True:
for event in pygame.event.get():
......@@ -82,13 +82,13 @@ while True:
time=0
num=random.randint(0,50)
if num>20:
obstacle=Block(bush,stone,cacti)
sprite_list.add(obstacle)
for sprite in sprite_list:
print(11)
obstacle=Block(bush,cacti,stone)
print(22)
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()
刷新画面
screen.blit(sprite.image, (sprite.rect.x,sprite.rect.y))
# 刷新画面
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