📌  相关文章
📜  如何检查 2 个精灵是否正在接触 js - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:26.450000             🧑  作者: Mango

代码示例1
function ImagesTouching(x1, y1, img1, x2, y2, img2) {
         if (x1 >= x2+img2.width || x1+img1.width <= x2) return false;   // too far to the side
         if (y1 >= y2+img2.height || y1+img1.height <= y2) return false; // too far above/below
         return true;                                                    // otherwise, overlap   
         }