Commit 62e95463 by BellCodeEditor

save project

parent acef3d97
Showing with 20 additions and 8 deletions
......@@ -41,12 +41,14 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero5.png')]
zhang_ai = Block(stone,cacti,bush)
block_list = pygame.sprite.Group()
#rect = zhang_ai.get_rect()
#rect.x=1000
#rect.y = 500-rect.height
index = 0
do = 0
while True: #不要动
wukong = hero[i] #不要动 #不要动 #不要动#不要动#不要动#不要动#不要动#不要动#不要动
......@@ -94,11 +96,21 @@ while True:
#障碍:随机,移动
if zhang_ai.rect.x <= 0-zhang_ai.rect.width:
zhang_ai = Block(stone,cacti,bush)
zhang_ai.rect.x -=8
screen.blit(zhang_ai.image,(zhang_ai.rect.x,zhang_ai.rect.y))
do += 1
if do >= 60:
r = random.randint(0,100)
if r > 40 :
zhang_ai = Block(stone,cacti,bush)
block_list.add(zhang_ai)
do = 0
for wu in block_list:
wu.rect.x -=8
screen.blit(wu.image,(wu.rect.x,wu.rect.y))
if wu.rect.x <= 0-wu.rect.width:
wu.kill()
print(len(block_list))
pygame.display.update()#保存
FPS.tick(40)# 刷新画面
\ No newline at end of file
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