def got_text(self, text): p = Parser(text, self.node.objects) action = p.match() new_node = None if not action.action: t = text.lstrip('Was willst du tun?') new_node = self.node.do_raw_input(t) if not new_node: print('Aktion: {0}'.format(action)) new_node = self.node.do(action) if isinstance(new_node, Node): self.node = new_node elif isinstance(new_node, Game): game = new_node def exit(won=False): game.exit(won) cocos.director.director.pop() self.screen.text(self.node.description) if self.node.background: self.screen.background.image = self.node.background game_obj = game.game_cls(exit) cocos.director.director.push(game_obj.main_scene()) self.screen.text(self.node.description) if self.node.background: self.screen.background.image = self.node.background
def main(): n = n1 while True: print('Beschreibung: '+ n.description) action = input('Aktion: ') p = Parser(action) n = n.do(p.match())