def death(flags, score): fon = pygame.transform.scale(load_image('go2.png'), (Width, Height)) screen.blit(fon, (0, 0)) font = pygame.font.Font(None, 100) text = font.render(str(score), 1, (255, 255, 255)) text_x = (Width - text.get_width()) // 2 screen.blit(text, (text_x, Height // 2)) pygame.display.flip() while True: clock.tick(FPS) for event in pygame.event.get(): keys = pygame.key.get_pressed() if event.type == 2: flags = cheat(keys, flags) if event.type == pygame.QUIT: return False, flags elif event.type == 2: flags = cheat(keys, flags) camera.restart() player.rect.x = Width // 2 - 50 player.rect.y = Height - player.height make_safezone() make_starter_palki() pygame.mixer.music.load(START_SONG) pygame.mixer.music.play(-1) return True, flags
def start_screen(): flags = [False, False, False] button = pygame.sprite.Group() ButtonStart(button) fon = FON screen.blit(fon, (0, 0)) button.draw(screen) pygame.display.flip() while True: clock.tick(FPS) for event in pygame.event.get(): keys = pygame.key.get_pressed() if event.type == 2: flags = cheat(keys, flags) if event.type == pygame.QUIT: return False, flags elif event.type == 5: return True, flags
def pause(flags): pause_flag = True surface = pygame.Surface(Size) surface.fill((200, 200, 200)) surface.set_alpha(150) screen.blit(surface, (0, 0)) pygame.display.flip() while pause_flag: clock.tick(FPS) for event in pygame.event.get(): keys = pygame.key.get_pressed() if event.type == 2: flags = cheat(keys, flags) if event.type == pygame.QUIT: return False, flags elif keys[27]: pause_flag = False return True, flags
def death(flags): fon = pygame.transform.scale(load_image('go2.png'), (Width, Height)) screen.blit(fon, (0, 0)) pygame.display.flip() while True: clock.tick(FPS) for event in pygame.event.get(): keys = pygame.key.get_pressed() if event.type == 2: flags = cheat(keys, flags) if event.type == pygame.QUIT: return False, flags elif event.type == 2: player.rect.x = Width // 2 - 50 player.rect.y = Height - player.height for i in range(Width // Platform.width + 1): UsualPlatform( (i * Platform.width, Height - Platform.height), safeplatforms) pygame.mixer.music.load(START_SONG) pygame.mixer.music.play(-1) return True, flags
if event.type == 5: if event.button == 1: UsualPlatform(event.pos, platform) if event.button == 3: SpeedUp(event.pos, speedup) if event.type == 2: keys = pygame.key.get_pressed() if keys[120]: XMovePlatform(pygame.mouse.get_pos(), moveplatform) if keys[121]: YMovePlatform(pygame.mouse.get_pos(), moveplatform) flags = cheat(keys, flags) for obj in moveplatform: obj.update() keys = pygame.key.get_pressed() if keys[pygame.K_LEFT] or keys[97]: player.change_x(-1) if keys[pygame.K_RIGHT] or keys[100]: player.change_x(1) all_sprites.update() death_flag = camera.update(player) camera.new_platforms(score) if flags[0] and death_flag: death_flag = False