Answers for "how to check if 2 images are touching js"

1

how to check if 2 images are touching js

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   
         }
Posted by: Guest on March-16-2020
1

how to check if 2 images are touching js

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   
         }
Posted by: Guest on March-16-2020

Code answers related to "how to check if 2 images are touching js"

Code answers related to "Javascript"

Browse Popular Code Answers by Language