lib/spritesheet.js
function rectshift(a, b) {
	if(a.x > b.x + b.width ||
		a.x + a.width < b.x ||
		a.y > b.y + b.height ||
		a.y + a.height < b.y) {
		return 0;
	} else {
		var overlap = b.x + b.width - a.x;
		return overlap;
	}
}
function rectshift(a, b) {
	if(a.x > b.x + b.width ||
		a.x + a.width < b.x ||
		a.y > b.y + b.height ||
		a.y + a.height < b.y) {
		return 0;
	} else {
		var overlap = b.x + b.width - a.x;
		return overlap;
	}
}
function rectshift ( a , b ) { if ( a . x > b . x + b . width || a . x + a . width < b . x || a . y > b . y + b . height || a . y + a . height < b . y ) { return 0 ; } else { var overlap = b . x + b . width - a . x ; return overlap ; } }
see if two rectangles overlap. if so, return the distance that A needs to shift to the right to avoid overlapping.
see if two rectangles overlap . if so return the distance that A needs to shift to the right to avoid overlapping .