The problem is: you create animations within loop. Replace part of your code with
if ( distanceformula( xcoord3, xboss, ycoord3, yboss ) < ((boss.outerWidth() / 2) + (objectify3.outerWidth() / 2)) ) {
console.log(1)
$( objectify3 ).animate( {
left: xmove3 + "px",
top: ymove3 + "px"
}, {
duration:3000,
step: function() {
console.log(2)
}
});
}
and open console.
You will see, that you created ~1000 animations (console.log(1) executes 1000 times) $( objectify3 ).animate
, and then jQuery run 1000 animations one after one. They will end in ~1000 * 3000 seconds.
I think you need a flag and run animations only once with first intersection.