function rect_collision(x1, y1, w1, h1, x2, y2, h2, w2) {
var top1 = y1;
var bottom1 = y1 + h1;
var left1 = x1;
var right1 = x1 + w1;
var top2 = y2;
var bottom2 = y2 + h2;
var left2 = x2;
var right2 = x2 + w2;
//console.log('----' + top1, bottom1, left1, right1, top2, bottom2, left2, right2 + '----');
//console.log('top 1: ' + top1);
//console.log('bottom 1: ' + bottom1);
//console.log('top 2: ' + top2);
//console.log('bottom 2: ' + bottom2);
//console.log('x1: ' + x1);
//console.log('x2: ' + x2);
//console.log('y2: ' + y2);
//console.log('h2: ' + h2);
//console.log(x1, y1, w1, h1, x2, y2, h2, w2);
//console.log('------------------------------------------------')
if !(x1 + w1 < x2 ||
x2 + w2 < x1 ||
y1 + h1 < y2 ||
y2 + h2 < y1) return true;
}
return false;
}