bool collision(Object& ll, Object& rr) { Coord llc = ll.get_coordinate(); Coord rrc = rr.get_coordinate(); if((llc.x <= rrc.x && llc.x + ll.width() >= rrc.x) || (rrc.x <= llc.x && rrc.x + rr.width() >= llc.x)) if((llc.y <= rrc.y && llc.y + ll.height() >= rrc.y) || (rrc.y <= llc.y && rrc.y + rr.height() >= llc.y)) return true; return false; }