示例#1
0
    def getTile(self, x, y) -> Tile:
        if (self.wrap_x and not (0 <= x < self.max_x)):
            x = utils.modu(x, self.max_x)
        if (self.wrap_y and not (0 <= y < self.max_y)):
            y = utils.modu(y, self.max_y)

        if not (0<=x<self.max_x):
            return self.IMPASSIBLE_TILE
        if not (0<=y<self.max_y):
            return self.IMPASSIBLE_TILE
        return self.tile_grid[x][y]
示例#2
0
    def getTile(self, x, y) -> Tile:
        if (self.wrap_x and not (0 <= x < self.max_x)):
            x = utils.modu(x, self.max_x)
        if (self.wrap_y and not (0 <= y < self.max_y)):
            y = utils.modu(y, self.max_y)

        if not (0 <= x < self.max_x):
            return self.IMPASSIBLE_TILE
        if not (0 <= y < self.max_y):
            return self.IMPASSIBLE_TILE
        return self.tile_grid[x][y]
示例#3
0
    def noise2d(self, x : int, y : int):
        """
        #Note: If random seed changes, we have an ENTIRELY new map.
        #Gets our noise function for a given coordinate.  MUST be an integer.
        #Returns the same random number for the same coordinates regardless of how many times it's called.
        #Returns a result that is between the lower and upper bounds of the amplitude.
        """

        if (self.wrap_x is not None):
            x = utils.modu(x, self.wrap_x)
        if (self.wrap_y is not None):
            y = utils.modu(y, self.wrap_y)

        random.seed('' + str(x) + 'x' + str(y) + 'y' + str(self.seed))
        noise = random.random()* (self.upper_bound-self.lower_bound) + self.lower_bound
        return noise
示例#4
0
 def noise2d(self, x: int, y: int):
     if (self.wrap_x is not None):
         x = utils.modu(x, self.wrap_x)
     if (self.wrap_y is not None):
         y = utils.modu(y, self.wrap_y)
     return x * 100 + y
示例#5
0
 def noise2d(self, x : int, y : int):
     if (self.wrap_x is not None):
         x = utils.modu(x, self.wrap_x)
     if (self.wrap_y is not None):
         y = utils.modu(y, self.wrap_y)
     return x*100 + y