Exemple #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]
Exemple #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]
Exemple #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
Exemple #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
 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