def onAction(self, player, action): if not player.inGame: return if action == Actions.BTN1: x = player.inGame.x y = player.inGame.y t = self.board.get(x, y) t.setType((t.type + 1) % TileTypes.MAX) else: return GamePhaseLayer.onAction(player, action) return True
def onAction(self, player, action): if not player.inGame: return False if action == Actions.BTN1: pi = self.placeInfo[player] obj = pi.obj if pi.numCannons >= obj.cannonCount: x = player.inGame.x y = player.inGame.y if obj.canPlace(player, self.board, x, y): c = obj(x, y) self.board.addObj(c) AllSounds.WALL.play(minTime = 0.3, maxInstances = 3) pi.numCannons -= obj.cannonCount if pi.numCannons > 0 and not self._checkPlayerSpace(player): pi.numCannons = 0 else: return GamePhaseLayer.onAction(self, player, action) return True