This is probably going to be something really simple and dumb, but why isnt this returning anything? I have this simple class method:
checkCollision(event) {
let eventX = event.clientX - canvasRect.left;
let eventY = event.clientY - canvasRect.top;
if (this.centerX - eventX <= this.radiusX && this.centerX - eventX >= (this.radiusX/-1) && this.centerY - eventY <= this.radiusY && this.centerY - eventY >= (this.radiusY/-1)) {
console.log(true);
return true;
} else {
console.log(false);
return false;
}
}
but its output in the browser when i run it is
> obj.checkCollision({clientX: 200, clientY: 200})
false
<- undefined
why isnt it returning anything? The console.log is running, but there is no return value