Coding Example from YouTube Video How to detect overlap between two page elements
X-Horizontal check formula : (a.x < (b.x + b.width)) && ((a.x + a.width) > b.x);
y-Vertical check formula : (a.y < (b.y+b.height)) && ((a.y + a.height) > b.y);
Moving the boxes
Box 1 Red - Moves with Arrow keys Box 2 Blue - Moves with A,W,S,Z keys
Move the boxes, check for overlap