Nested Loop help -- concerning image repetition
I'm relatively new to the forums, and very new to java. I'm currently supposed to be writing a program that alternates faces on the paint canvas. I've got everything down, as far as the alternating faces go and having the printed faces set up... however, I can't get it to repeat the faces a certain number of times, break, and then go to the next line. I need something like 4 faces per line, alternating. and I need to use nested for loops to do it...its got me stumped.
Here's the little chunk of code I'm working on that that has neither correct syntax and probably not correct logic but i'm still working on it so...
Basically I'm trying to put a for loop inside a for loop, but I haven't worked with this much. I'm trying to say something like "once xOffset reaches a certain point use yOffset once to move it down then repeat the loop...then do the yOffset part again.
int value = 0, xOffset = 0, yOffset = 0;
for (yOffset = 0, xOffset = 0, value = 0; xOffset <= 2000; xOffset++)
if (xOffset <= 2000)
xOffset = 200 * value;
yOffset = 200 * value;
for (value = 0; value <= 4; value++)
sadFace(xOffset, yOffset, canvas);
happyFace(xOffset, yOffset, canvas);
Not even sure if this makes sense to anyone, but I thought i'd give it a shot. Any sort of help would be appreciated...pokes in the right directions..alternative ways of thinking, etc.
Thanks for any help.