Can someone explain why this doesnt work? Im just trying to get it when the rectangle is clicked the ball moves..
Code
var ty = 0;
var x = 388;
var y = 388;
draw = function() {
background(46, 130, 229);
//button
rect(x, y, -80, -77);
//draw the character
fill(4, 35, 72);
ellipse(200, ty, 60, 60);
//only if the user has clicked on the box should the ball move
if (mouseIsPressed){
if (mouseY > y + x && mouseY < y && mouseX > y + x && mouseX < x){
ty+=1;
}
}
};