コード例 #1
0
ファイル: main.py プロジェクト: AdmiralPavel/pygameProject
 if len(powerup_group.spritedict.keys()):
     temp_power_up = list(powerup_group.spritedict.keys())[0].type
 powerup_hits = pygame.sprite.spritecollide(
     player, powerup_group, True, pygame.sprite.collide_circle)
 if powerup_hits:
     if temp_power_up == 0:
         lives += 1
         live = Live(10 + len(lives_list) * 50, 10)
         all_sprites.add(live)
         lives_list.append(live)
         lives_group.add(live)
     elif temp_power_up == 3:
         variables.scores += 10
 new_timer = time.time()
 if new_timer - timer >= 3:
     player.flicker = False
     if hits:
         if lives != 0:
             timer = time.time()
             lives -= 1
             player.flicker = True
             lives_group.remove(lives_list.pop())
         else:
             running = False
 screen.fill(BLACK)
 screen.blit(background, background_rect)
 all_sprites.draw(screen)
 lives_group.draw(screen)
 draw_text("Счёт " + str(variables.scores), 40, WIDTH / 2, 10)
 draw_text("Лучший счёт " + str(best_score), 40, WIDTH - 150, 10)
 pygame.display.flip()