def creategoal(self, goalimagelist, worth, name): """ Create a new goal object (recursive until no longer blocked) :param goalimagelist: (Dict) Dict of images to create the goal (should contain one, keyed on 'image')) :param worth: (int) Points value of the goal :param name: (string) Name of the goal :return: (Goal) Goal object """ goal = Goal(goalimagelist, worth, name, self.screen.get_width(), self.screen.get_height()) if not pygame.sprite.spritecollide(goal, self.blocklist, False, pygame.sprite.collide_circle): self.blocklist.add(goal) else: goal.kill() goal = self.creategoal(goalimagelist, worth, name) return goal