def __init__(self): """ Initialize the Main Menu Controller """ self.currentPlayer = PlayerFactory.getLastPlayer() entries = [TextMenuEntry("New", self.newGame), TextMenuEntry("Options", self.runOptions), TextMenuEntry("Exit", self.stopRunning)] self.menu = Menu(entries) if self.currentPlayer is not None: continueMenuEntry = TextMenuEntry("Continue", self.continueGame) entries.insert(1, continueMenuEntry) self.menu.down() screen = MainMenuScreen(self.menu, self.currentPlayer) PygameController.__init__(self, screen, commands = {commands.UP:self.menu.up, commands.DOWN:self.menu.down, commands.EXIT:self.stopRunning, commands.SELECT:self.menu.enter})
def newGame(self, entry): """ Start a New Game """ PlayerFactory.createNewPlayer("Doe")