xxxxxxxxxx
32
var on= true;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0);
stroke(255);
strokeWeight(3);
noFill();
rectMode(CENTER);
if (mouseX >150 && mouseX < 250 && mouseY >150 && mouseY <250) {
//why is it between 150 and 250 when 200+100 is 300. the math doesn't make sense to me?
if (mouseIsPressed) {
background(0, 255, 0);
}
fill("green");
}
rect(200,200,100,100); //why does the rect have to go here and not before the if statement?
}