def __init__(self, player1_path, player2_path): self.match_id = None self.player = Player(player1_path) if player1_path else None if self.player: self.player1_path = player1_path self.player.set_player_id(1) self.player2 = Player(player2_path) if player2_path else None if self.player2: self.player2_path = player2_path self.player2.set_player_id(0) self.turn_repeat = False self.UI = SimulatorUI(settings) self.UI.setTitle("Robot Game Simulator") self.state = GameState(settings, turn=1) self.cached_actions = None self.human_actions = {} self.UI.setTurn(self.state.turn) self.UI.bind("w", lambda ev: self.UI.moveSelection((0, -1))) self.UI.bind("a", lambda ev: self.UI.moveSelection((-1, 0))) self.UI.bind("s", lambda ev: self.UI.moveSelection((0, 1))) self.UI.bind("d", lambda ev: self.UI.moveSelection((1, 0))) self.UI.bind("<Up>", lambda ev: self.UI.moveSelection((0, -1))) self.UI.bind("<Left>", lambda ev: self.UI.moveSelection((-1, 0))) self.UI.bind("<Down>", lambda ev: self.UI.moveSelection((0, 1))) self.UI.bind("<Right>", lambda ev: self.UI.moveSelection((1, 0))) self.UI.bind("<ButtonPress-1>", lambda ev: self.UI.onMouseClick(ev)) self.UI.bind("l", self.onLoadMatch) self.UI.bind("k", self.onLoadTurn) self.UI.bind("o", self.onReloadPlayer) self.UI.bind("p", self.onSwapPlayer) self.UI.bind("t", self.onEditTurn) self.UI.bind("f", self.onAddTeammate) self.UI.bind("e", self.onAddEnemy) self.UI.bind("r", self.onRemove) self.UI.bind("c", self.onClear) self.UI.bind("<Delete>", self.onRemove) self.UI.bind("<BackSpace>", self.onRemove) self.UI.bind("h", self.onEditHP) self.UI.bind("<space>", self.onShowActions) self.UI.bind("<Return>", self.onSimulate) self.UI.bind("n", self.onNextAction) self.UI.bind("g", self.onSpawnRobots) self.UI.run()