def lint_and_run_game(pylint_args, fullscreen, resolution): """Run pylint, get the output, parse it, initialize the game and run it.""" animal_groups = create_animals(parse(lint(pylint_args))) flags = pygame.FULLSCREEN if fullscreen else 0 if not resolution and not fullscreen: resolution = (600, 600) screen = pygame.display.set_mode((0, 0) if fullscreen else resolution, flags) organize_groups(screen, animal_groups) engine = Engine(screen) for animal_group in animal_groups: engine.add_animals(*animal_group) engine.start()
def test_game(): animal1 = Animal(shape="Y", max_health=2, size=40) animal2 = Animal(shape="X", max_health=2, size=40) animal1.also_likes_to_eat(animal2) animal2.also_likes_to_eat(animal1) screen = pygame.display.set_mode((600, 600)) animal1.put_relative(30, 30, screen) animal2.put_relative(60, 60, screen) engine = Engine(screen) engine.add_animals(animal1, animal2) engine.start()