My game has tiles on a mesh this is the code I use to make a 2 by by 2 square
void MakePatch() { for(int x=0; x<
size_x;x++) { for(int y=0; y<
size_y;y++) {//spawn stone patches int randomStoneOrBlack = Random.Range(0,200);//higher the lowerchance of it spawning
if(randomStoneOrBlack == 0)
{
if(x - 2 <= 0 || x - 2 >= size_x - 2 || y - 2 <= 0 || y -2 >= size_y - 2) {
}
else
{
map_data[x - 0,y - 0]=3;//bottom left
map_data[x - 1,y - 0]=3;//bottom right
map_data[x - 0,y - 1]=3; //top left
map_data[x - 1,y - 1]=3; //top right
}
}//test if(randomStoneOrBlack == 0) { if(x - 2 <= 0 || x - 2 >= size_x - 2 || y - 2 <= 0 || y -2 >= size_y - 2) { } else { map_data[x - 0,y - 0]=0;//bottom left map_data[x - 1,y - 0]=0;//bottom right map_data[x - 0,y - 1]=0; //top left map_data[x - 1,y - 1]=0; //top right } } } } }
This creates a 2 by 2 square
map_data[x - 0,y - 0]=0;//bottom left
map_data[x - 1,y - 0]=0;//bottom right
map_data[x - 0,y - 1]=0; //top left
map_data[x - 1,y - 1]=0; //top right
Its great that I can make a square, but what I have to keep in mind I have to go negative as shown to create the square, if I go positive it wont work, but the it can be negative it doesn’t matter, I was wonder if anyone knew a way to create shapes like a circles, triangles etc… these are 1 by 1 squares. I tried making a Visual C# program to do this for my in text, but my math was not good enough, I was wondering if anyone know a way I can create shapes?