Formula to draw pyramid of circles
Posted
by terence6
on Stack Overflow
See other posts from Stack Overflow
or by terence6
Published on 2010-06-14T02:33:34Z
Indexed on
2010/06/14
2:42 UTC
Read the original article
Hit count: 283
I'm trying to create a pyramid of circles to my game, looking similar to this :
But I can't make it print properly. Constantly I'm getting really strange spirals but nothing close to this. Can anyone give me some tip on proper formula ? My window is 600x600, base of pyramid is 8 .
fields = new Field[BASE*(BASE/2)+4];
int line_count = BASE;
int line_tmp = line_count;
for(int i=0; i< fields.length; i++){
for( int j=line_tmp; j <= line_count; j++){
fields[i] = new Field(0, (150+(line_tmp*5)),(600+line_tmp*5));
}
line_count--;
line_tmp = line_count;
}
© Stack Overflow or respective owner