I notice that sometimes your openSimplex2D method generates negative numbers. You can see an example in this screenshot:
Here is part of the code I'm using with your SoftNoise class
extends TileMap
const preScript = preload("res://scripts/utils/noise.gd")
onready var softnoise = preScript.SoftNoise.new(1239)
func map2tile(value, tilemin, tilemax):
# Check that the values were passed in correct order
if tilemin > tilemax:
var tmp = tilemax
tilemax = tilemin
tilemin = tmp
var this = tilemin + (tilemax - tilemin - 1) * value
if this < 0:
breakpoint
return this
func draw_tiles(w, h):
# Draw tiles
# 0: Sand, 1: Sand with grass, 2: Grass, 3: Dark grass
for i in range(w):
for j in range(h):
var value = softnoise.openSimplex2D(i, j)
var tilen = map2tile(value, 0, 4)
set_cell(i, j, tilen)
Because of this illegal value returned by the method the end result on my game's level do not look that nice:
I'm using your class in Godot 3.0 stable.
I notice that sometimes your openSimplex2D method generates negative numbers. You can see an example in this screenshot:
Here is part of the code I'm using with your SoftNoise class
Because of this illegal value returned by the method the end result on my game's level do not look that nice: