@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
11 lines (10 loc) • 396 B
JavaScript
function collideRectRect(rect1, rect2) {
return rect1.x + rect1.width >= rect2.x && // rect1 right edge past rect2 left AND
rect1.x <= rect2.x + rect2.width && // rect1 left edge past rect2 right AND
rect1.y + rect1.height >= rect2.y && // rect1 top edge past rect2 bottom AND
rect1.y <= rect2.y + rect2.height;
}
export {
collideRectRect
};
//# sourceMappingURL=collideRectRect.js.map