Example #1
0
    def make_puddles(self):
        for y in range(self.height):
            for x in range(self.width):
                ripple = (snoise2(x / 4, y / 4, 1) + 8) / 8
                n = self.heightmap[x][y]
                if n <= 0.2:
                    self.color_array[x][y] = shade_color(
                        (20, 110, 140), light=(ripple + 1) / 2
                    )
                elif n <= 0.5:
                    self.color_array[x][y] = shade_color(
                        (30, 120, 170), light=(ripple + 1) / 2
                    )
                elif n < 0.7:
                    self.color_array[x][y] = shade_color(
                        (100, 165, 205), light=(ripple + 1) / 2
                    )
                elif n < 1:
                    c = alpha_blend_color(
                        self.color_array[x][y],
                        (100, 75, 60), 0.7
                    )
                    self.color_array[x][y] = c

                if n < 0.7:
                    self.blocked_grid[x][y] = True
Example #2
0
 def draw_path(self):
     c = (100, 85, 50)
     for x, y in self.console:
         if self.path_grid[x][y]:
             if self.path_grid[x][y] > 0.05:
                 if self.check_on_screen(x, y):
                     if self.path_grid[x][y] > 0.95:
                         a = 0.98
                     else:
                         a = self.path_grid[x][y]
                     value = (snoise2(x / 2, y / 2, 1) + 8) / 8
                     new_c = shade_color(
                         c, light=value
                     )
                     new_c = alpha_blend_color(
                         self.color_array[x][y], new_c, a
                     )
                     self.path_console.draw_char(
                         x, y, None, bg=new_c
                     )