The goal is to create a code that allows you to choose the color of a shape (in this case an ellipse, and using red,green,and blue) by using keyPressed, and then to be able to click on the screen and have an ellipse show up in a random part of the screen. Everything is working except for the color selector(i.e. the keyPressed function).
switch(key) {
case 'r':
case 'R':
r = 255;
g = 0;
b = 0;
break;
case 'g':
case 'G':
r = 0;
g = 255;
b = 0;
break;
case 'b':
case 'B':
r = 0;
g = 0;
b = 255;
break;
default:
break;
}
}
void drawShape(int x, int y){
ellipse(x,y,25,25);
}
Add a variable that will keep track of something related to the state of your picture. For example, you might keep track of the color you want to fill your shape with.