Hi nearly I start intrestring a procedural generated map because I would add this into my project so first I created new project to test code from internet I searched and searched finally I found a code with NoiseMap who work partly because this generates procedural stuff but with one texture and here is my question someone could tell what there work wrong. btw sorry for my bad english
using Godot;
using System;
public class randomMap : TileMap
{
OpenSimplexNoise osn;
public void create_noise(int x,int y,int width,int height)
{
Random rnd = new Random();
int randomtexture = rnd.Next(0, 4);
for (int x_pos = 0; x_pos < width; x_pos++)
{
for (int y_pos = 0; y_pos < height; y_pos++)
{
SetCell(x_pos + x, y_pos + y, (int)osn.GetNoise2d(x_pos+x, y_pos+y)*2+2);
}
}
}
public override void _Ready()
{
Random rnd = new Random();
osn = new OpenSimplexNoise();
int randomInt = rnd.Next(0, 100);
GD.Print(randomInt);
osn.Seed = randomInt;
osn.Octaves = 4;
osn.Period = 15;
osn.Lacunarity = 1.5f;
osn.Persistence = 0.75f;
create_noise(100, 100, 100, 100);
}
public override void _Process(float delta)
{
Camera2D camera = GetNode<Camera2D>("Camera2D");
camera.Position += (GetGlobalMousePosition() - camera.Position).Normalized() * 1000 * delta;
}
}
Aucun commentaire:
Enregistrer un commentaire