see if offset works for you
OffsetXY example
by implementing the above offsetXY you also remove lots of events that you duplicated as subevents to check all those leftrighttopbottom etc
drag the green box around , at around 25pixels overlap left top bottom right it will turn red, if is not overlaping at offset returns to green ... i think this is what you wanted ... all you need is adapt it to your movement behavior.
rule of offsetDirection: OffsetX +25 is Right, OffsetX -25 is Left, OffsetY +25 is bottom and OffsetY -25 is Top.
the offset works from the greenbox bboxtop,bottom,left,right ... based on the origin point of the image i think didn't messed with that origin point.