@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
17 lines (16 loc) • 587 B
TypeScript
/**
* @typedef {Object} Rect
* @property {number} x Rectangle's x position
* @property {number} y Rectangle's y position
* @property {number} width Rectangle's width
* @property {number} height Rectangle's height
*/
/**
* Test if a rectangle collides with another rectangle.
* Inspired by http://www.jeffreythompson.org/collision-detection/rect-rect.php
*
* @param {Rect} rect1 Rectangle 1
* @param {Rect} rect2 Rectangle 2
* @returns {boolean} Are the sides of one rectangle touching the other ?
*/
export declare function collideRectRect(rect1: any, rect2: any): boolean;