After numerous attempts, I have developed a small "game" that incorporates collision detection.
Unfortunately, I have encountered a persistent issue where objects sometimes pass through each other. The root cause of this problem eludes me completely.
Initially, I crafted my own detection mechanism, which I have since commented out. I then resorted to using the following approach:
Access the code sample on fiddle
function rectanglesIntersect( minAx, minAy, maxAx, maxAy, minBx, minBy, maxBx, maxBy ) {
var aLeftOfB = maxAx < minBx;
var aRightOfB = minAx > maxBx;
var aAboveB = minAy > maxBy;
var aBelowB = maxAy < minBy;
return !( aLeftOfB || aRightOfB || aAboveB || aBelowB );
}