xxxxxxxxxx
var hit = false;
lastX=0;
lastY=0;
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
collideDebug(true);
lastX=mouseX;
lastY=mouseY;
}
function draw() {
background(255);
rect(200,200,100,150);
hit = collideRectCircle(200,200,100,150,mouseX,mouseY,100);
if (hit){
ellipse(lastX,lastY,100,100);
}
else{
ellipse(mouseX,mouseY,100,100);
lastX=mouseX;
lastY=mouseY;
}
print("En collision? " + hit);
}