There was an issue where the ground types of 'hills' and 'canyon' were not using the seed. Based on issue #44, it seems that the intention was to use the seed to keep the layout consistent similar to the other ground types, 'noise' and 'spikes'. Below is an explanation of the steps I took to fix the issue:
Added custom seed as a parameter to the perlin object in the updateGround function
With this change, if the case that "hills" or "canyon" are used, the seed is being passed into the perlin.noise method.
In the Perlin Noise Generator, I created a variable called randomWithSeed that will be used in the for loop to generate random numbers using the seed.
This logic was essentially taken from the random function defined earlier in the code
In that same for loop, I replaced r.random(666) with the new randomWithSeed variable
Since the r variable is no longer used, I simplified the function by removing it as a parameter and as well as the line if (r == undefined) r = Math;, which isn't needed.
I added seed as a parameter so we can pull in the user's custom seed when generating the randomWithSeed number.
There was an issue where the ground types of 'hills' and 'canyon' were not using the seed. Based on issue #44, it seems that the intention was to use the seed to keep the layout consistent similar to the other ground types, 'noise' and 'spikes'. Below is an explanation of the steps I took to fix the issue:
perlin
object in theupdateGround
functionperlin.noise
method.randomWithSeed
that will be used in the for loop to generate random numbers using the seed.random
function defined earlier in the coder.random(666)
with the newrandomWithSeed
variabler
variable is no longer used, I simplified the function by removing it as a parameter and as well as the lineif (r == undefined) r = Math;
, which isn't needed.seed
as a parameter so we can pull in the user's custom seed when generating therandomWithSeed
number.Fixes Issues