java - How to draw 6 boxes and after the first 3 change the position of the final 3 -


i'm trying draw 6 boxes loop, have first 3 boxes drawn @ curtain x , y coordinate after first 3 have been drawn draw final 3 @ same x coordinate @ different y coordinate.

more detail: boxes have same width , height have 10 px of space between each needs repeatable infinite amount of boxes

for(int = 0; < bricks.length; i++) {     bricks[i].setsize(size);     if(i <= 2) {         bricks[i].setposition(i * (size + 10) + 180, 20);        }     bricks[i].setstate(brickstate.white); } 

for(int = 0; < bricks.length; i++) {     bricks[i].setsize(size);     bricks[i].setposition((i%3) * (size + 10) + 180, (i/3) * (ysize +10) + yoffset);        bricks[i].setstate(brickstate.white); }     

by using i%3 instead of resulting x positions 0 1 2 0 1 2. move on start when go next line. y code i/3 give 0 0 0 1 1 1 therefore moving last 3 boxes down one.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -