Hi,
I am using the following code to generate a seed for a simplexnoise world, and I want to draw this in a different class to display it in game,
Here is the code for the seed and how I am displaying it in the console:
public SimplexNoise() {
p=p_supply.clone();
int seed = SimplexNoise.RANDOMSEED;
if (seed==RANDOMSEED){
Random rand=new Random();
seed=rand.nextInt();
}
//the random for the swaps
Random rand=new Random(seed);
//Print the seed in the terminal
System.out.println("Seed:" + seed);
//the seed determines the swaps that occur between the default order and the order we're actually going to use
for(int i=0;i<NUMBEROFSWAPS;i++){
int swapFrom=rand.nextInt(p.length);
int swapTo=rand.nextInt(p.length);
short temp=p[swapFrom];
p[swapFrom]=p[swapTo];
p[swapTo]=temp;
}
for(int i=0; i<512; i++)
{
perm[i]=p[i & 255];
permMod12[i] = (short)(perm[i] % 12);
}
}
this is how ive been trying to draw it in a different class:
RandomTerrain.loadText();
MenuCore.font.drawString(50,
50, "Seed:" + SimplexNoise.seed, Color.white);
RandomTerrain.cleanUp();
everything works except SimplexNoise.seed, because the int has to be after this line
p=p_supply.clone();
Thanks,
- Dan