Thank you very much for your reply, I have a much more simple code that I mentioned in the post that I adapted, it is this one, and it works, very similar to yours, but when I implemented in mine, the relevant parts they are the same (switch, case numbers, etc..)
but for some reason it does not work in mine, here is the example code very similar to yours that I did before I implemented the switch
states with keyboard input:
int sketchToDraw;
void setup() {
size(500, 500);
noStroke();
smooth();
}
void draw() {
switch(sketchToDraw) {
case 0: drawScreenOne(); break;
case 1: drawScreenTwo(); break;
case 2: drawScreenThree(); break;
default: background(0); break;
}
}
void keyPressed() {
if (key=='1')
sketchToDraw = 0;
if (key == '2')
sketchToDraw = 1;
if (key == '3')
sketchToDraw = 2;
if (key == '4')
println("left");
}
/// the functions found in tabs that I call from the main `draw()`
void drawScreenOne() {
background(255, 0, 0);
fill(255);
ellipse(100, 100, 400, 400);
}
void drawScreenTwo() {
background(0, 255, 0);
fill(0);
rect(250, 40, 250, 400);
}
void drawScreenThree() {
background(0, 0, 255);
fill(255, 255, 0);
triangle(150, 100, 150, 400, 450, 250);
}