private void GenerateTerrain() { Random rand = new Random(); //Grass Noise.Seed = rand.Next(0, 999999999); int flatness = 100; float[] noise = Noise.Calc1D(flatness * LEVELONEWIDTH, 0.1f); Terrain = new List <List <int> >((int)(Game.Resolution.Y / TILESIZE)); Heights = new int[LEVELONEWIDTH]; for (int y = 0; y < (int)(Game.Resolution.Y / TILESIZE); y++) { Terrain.Add(new List <int>(LEVELONEWIDTH)); for (int x = 0; x < LEVELONEWIDTH; x++) { int height = 0; for (int i = 0; i < flatness; i++) { height += (int)noise[x + i]; } height /= (int)(flatness * 5f); height -= 13; if (y == height) { Heights[x] = height; Terrain[y].Add(GameScreen.GRASS); } else if (y < height) { Terrain[y].Add(GameScreen.AIR); } else if (y > height) { Terrain[y].Add(GameScreen.DIRT); } } } Flowers = new bool[LEVELONEWIDTH]; for (int x = 0; x < LEVELONEWIDTH; x++) { int num = (int)(rand.NextDouble() * 10); if (num == 1) { Flowers[x] = true; } else { Flowers[x] = false; } } }