//PImage bg = new PImage; int w = 400; int h = 400; float inc = .6; int density = 20; Material[][] squares = new Material[w/density][h/density]; float znoise = 1; //materials and ground: color red = color(255,0,0); color green = color(0, 255, 0); color blue = color(0,0,255); color brown = color(150, 75, 0); void setup() { size(w, h); noStroke(); frameRate(8); background(red); noStroke(); for (int y = 0; y < height/density; y++) { for (int x = 0; x < width/density; x++) { int tempX = x*density; int tempY = y*density; squares[x][y] = new Material(tempX, tempY, density); } } } void draw() { float xnoise = 0.0; float ynoise = 0.0; if(frameCount%3 == 0) { background(brown); for (int y = 0; y < height/density; y++) { //this iterates through the grid y for (int x = 0; x < width/density; x++) { //this iterates through the grid x if((x==0) || (y==0) || (x==width/density-1) || (y==height/density-1)) squares[y][x].update(brown, 255.0); // this checks if the grid is iterating on an edge if it is it'll just draw a blank brown square with no opacity shifting else { //otherise continue /* this is where the rule set goes!! */ float n = noise(xnoise, ynoise, znoise)*50; //creates the noise number if(n > 255) n = 255; //keeps the noise number in the range of a color squares[y][x].update(0, n); //assigns a material type and xnoise += inc; } } xnoise = 0; ynoise += inc; } znoise += inc; } } /* int adjacentNeighbors(int x, int y) { } int diagonalNeighnors(int x, int y) { } */