/* 6.914, Example 4.A Using switch-case to change between screens. */ int counter = 1; void setup(){ size(200, 200); } void draw(){ switch (counter){ case (1): background(255); stroke(0); line(0, 0, width, height); break; case(2): background(100); stroke(255); line(0, height, width, 0); break; case(3): background(0); stroke(255); line(0, height/2, width, height/2); break; } } void mousePressed(){ if (mouseX < width/2){ counter = max(1, counter-1); // don't go below 1 } else if (mouseX > width/2){ counter = min(3, counter+1); // don't go above 3 } }