Detecting collision:

Given 2 boxangles box1 and box2 with these 4 properties

overlapping

  box1 box2
x 5 7
y 5 2
w 6 3
h 3 5
if (box1.x < box2.x + box2.w &&
box1.x + box1.w > box2.x &&
box1.y < box2.y + box2.h &&
box1.h + box1.y > box2.y)
if (5 < 7 + 3 && 5 + 6 > 7 && 5 < 2 + 5 && 3 + 5 > 2)
if(  5 < 10   &&  11 > 7   &&  5 < 7    &&   8 > 2)

You do the other ones

overlaps

  box1 box2   orange box green box   pale green box dark blue box dark red box   purple box yellow box
x                        
y                        
w                        
h