Problem with Loops - Processing Beginner
in
Programming Questions
•
1 year ago
Hi I'm trying to draw up a sudoku board and I'm having issues with drawing the horizontal aspect of the code
Whenever I draw up the code for the horizontal the entire canvas is erased
Please help! thanks!
Please help! thanks!
int endLegs = 650;
int yThick = 50; // Vertical location of each line
int xThick = 50; // Initial horizontal location for first line
int spacingVThick = 200; // How far apart is each line
int len = 600; // Length of each line
int yThin = 50; // Vertical location of each line
int xThin = 50; // Initial horizontal location for first line
int spacingVThin = 67; // How far apart is each line
int xHoriThick = 50;
int yHoriThick = 50;
int HSpacingThick = 200;
void setup() {
size (700, 700);
background(255);
rectMode (CENTER);
rect(350, 350, 600, 600);
}
void draw () {
strokeWeight (5);
while (xThick <= endLegs) {
line (xThick, yThick, xThick, yThick + len);
xThick = xThick + spacingVThick;
}
strokeWeight(0);
while (xThin <= endLegs) {
line (xThin, yThin, xThin, yThin + len);
xThin = xThin + spacingVThin;
}
}
1