the background turn white when collision happens, also terminal is printing the distance between two squares the same time.
function draw() {
background(back);
fill(255,240,245);
var v1 = createVector(600, 350);
var v2 = createVector(mouseX, mouseY);
rect(v1.x, v1.y, 50, 50);
rect(mouseX, mouseY, 50, 50);
if(mouseX>(600-50)& mouseX<(600+50)&mouseY>(350-50)&mouseY<(350+50) ){
back=255;
}else{
back=0;
}
var distance = p5.Vector.dist(v1,v2);
print(distance);
}