Example #1
0
    def shiftNE(self, oldc, x):
        # redraw bounds of maze
        for i in range(x):
            self.land.insert(0, [])
        for i in range(0, self.rows):
            if i < x:
                for j in range(self.cols):
                    self.land[i].append(tile.Tile())
            else:
                for j in range(x):
                    self.land[i].append(tile.Tile())

        self.connectDictionary()
        self.player.X = self.player.loc.X
        self.player.Y = self.player.loc.Y

        for baddy in self.enemies:
            baddy.X = baddy.loc.X
            baddy.Y = baddy.loc.Y

        self.setBarriers(0, x, 0, self.cols)
        self.setBarriers(x, self.rows, oldc, self.cols)

        self.checkBarriers()

        self.randomSpot(0, x, 0, self.cols).holding = "phase"
        self.randomSpot(x, self.rows, oldc, self.cols).holding = "phase"
Example #2
0
    def __init__(self, rows, cols, player, enemies, **kwargs):
        self.player = player
        self.enemies = enemies
        self.rows = rows
        self.cols = cols
        self.start = None
        self.exit = None

        # create player image
        self.playerImage = None

        # create list of tiles
        self.land = [[tile.Tile() for j in range(cols)] for i in range(rows)]

        # connect tiles in a dictionary
        self.connectDictionary()

        self.corners = [
            self.land[0][0], self.land[0][self.cols - 1],
            self.land[self.rows - 1][self.cols - 1],
            self.land[self.rows - 1][0]
        ]

        # should there be barriers?
        if "barriers" in kwargs:
            if kwargs["barriers"]:
                self.setBarriers(0, self.rows, 0, self.cols)
        else:
            self.setBarriers(0, self.rows, 0, self.cols)
Example #3
0
    def shiftSW(self, oldr, x):
        for row in self.land:
            for i in range(x):
                row.insert(0, tile.Tile())
        for i in range(x):
            self.land.append([tile.Tile() for j in range(self.cols)])

        # connect the dictionary
        self.connectDictionary()
        self.player.X = self.player.loc.X
        self.player.Y = self.player.loc.Y

        for baddy in self.enemies:
            baddy.X = baddy.loc.X
            baddy.Y = baddy.loc.Y

        # set barriers
        self.setBarriers(0, oldr, 0, x)
        self.setBarriers(oldr, self.rows, 0, self.cols)

        self.checkBarriers()

        self.randomSpot(0, oldr, 0, x).holding = "phase"
        self.randomSpot(oldr, self.rows, 0, self.cols).holding = "phase"
Example #4
0
    def shiftSE(self, oldr, oldc, x):
        # redraw bounds of maze
        for row in self.land:
            for i in range(x):
                row.append(tile.Tile())
        for i in range(x):
            self.land.append([tile.Title() for j in range(self.cols)])
        # connect the dictionary
        self.connectDictionary()

        for baddy in self.enemies:
            baddy.X = baddy.loc.X
            baddy.Y = baddy.loc.Y

        # set barriers
        self.setBarriers(0, oldr, oldc, self.cols)
        self.setBarriers(oldr, self.rows, 0, self.cols)

        self.checkBarriers()

        self.randomSpot(0, oldr, oldc, self.cols).holding = "phase"
        self.randomSpot(oldr, self.rows, 0, self.cols).holding = "phase"