hi everybody,
I would like to built a sketch with proce55ing, but my limited knowledge doesn't allow me to solve a problem so i ask you a suggestion.
My goal is to have a generator of random squares that cover the entire stage, to obtain a pattern.
I succeded in building two growing crosses that stop when they collide.
I would like to have an higher number of crosses, repeting the same behaviour.
I've worked in a crafting way to built the first two crosses, so, is there a way to multiply this objects or do i have to choose another metod?
I'm afraid i should use classes or array, but i'm not able and i have not enough time to spent for learning.
thanks for any suggestion.
Quote:
float aar = random(200);
int ar = int(aar);
float bbr = random(200);
int br = int(bbr);
int cr = ar;
int dr = br;
int er = ar;
int fr = br;
int gr = ar;
int hr = br;
float aar2 = random(200);
int ar2 = int(aar2);
float bbr2 = random(200);
int br2 = int(bbr2);
int cr2 = ar2;
int dr2 = br2;
int er2 = ar2;
int fr2 = br2;
int gr2 = ar2;
int hr2 = br2;
void setup()
{
size(200, 200);
background(200,0,0);
fill(0);
}
void draw()
{
ar++;
point(ar, br);
color a1 = get(ar+1, br);
color a2 = get(ar, br);
if(a1 == a2) {
ar=ar-1;
}
cr--;
point(cr, dr);
color b1 = get(cr, dr-1);
color b2 = get(cr, dr);
if(b1 == b2) {
cr=cr+1;
}
fr++;
point(er, fr);
color c1 = get(er, fr+1);
color c2 = get(er, fr);
if(c1 == c2) {
fr=fr-1;
}
hr--;
point(gr, hr);
color d1 = get(gr, hr-1);
color d2 = get(gr, hr);
if(d1 == d2) {
hr=hr+1;
}
ar2++;
point(ar2, br2);
color e1 = get(ar2+1, br2);
color e2 = get(ar2, br2);
if(e1 == e2) {
ar2=ar2-1;
}
cr2--;
point(cr2, dr2);
color f1 = get(cr2, dr2-1);
color f2 = get(cr2, dr2);
if(f1 == f2) {
cr2=cr2+1;
}
fr2++;
point(er2, fr2);
color g1 = get(er2, fr2+1);
color g2 = get(er2, fr2);
if(g1 == g2) {
fr2=fr2-1;
}
hr2--;
point(gr2, hr2);
color h1 = get(gr2, hr2-1);
color h2 = get(gr2, hr2);
if(h1 == h2) {
hr2=hr2+1;
}
}