xxxxxxxxxx
28
function setup() {
createCanvas(400, 400);
}
function draw() {
fill(0,0,0);
textSize(21);
textAlign(CENTER);
text("click to place a square",200,30);
text("press r for red, g for green",200,55);
text("b for blue, and 0 for black",200,80);
if(key === 'r'){
fill(255,0,0);
}
if(key === 'g'){
fill(0,255,0);
}
if(key === 'b'){
fill(0,0,255);
}
if(key === '0'){
fill(0);
}
}
function mouseClicked(){
rect(mouseX - 15,mouseY - 15,30);
}