diff --git a/sdlpp/sdlpp_collision.cpp b/sdlpp/sdlpp_collision.cpp index 63ad7e1..3ab0d42 100644 --- a/sdlpp/sdlpp_collision.cpp +++ b/sdlpp/sdlpp_collision.cpp @@ -72,6 +72,16 @@ bool intersects( const SDLPP::CollisionPolygon &p1, if ( p1.rightmost() < p2.leftmost() || p2.rightmost() < p1.leftmost() || p1.bottommost() < p2.topmost() || p2.bottommost() < p1.topmost() ) return false; + if ( p1.leftmost() < p2.leftmost() && p1.topmost() < p2.topmost() && + p1.rightmost() > p2.rightmost() && + p1.bottommost() > p2.bottommost() ) { + return true; + } + if ( p2.leftmost() < p1.leftmost() && p2.topmost() < p1.topmost() && + p2.rightmost() > p1.rightmost() && + p2.bottommost() > p1.bottommost() ) { + return true; + } for ( auto &line : p1.getLines() ) { for ( auto &line2 : p2.getLines() ) { if ( linesCross( line, line2 ) )