Comment on why we need overlapping collision rectangles.

pull/28/head
sigonasr2 1 year ago
parent 4e03580df1
commit d6ef557a1c
  1. 1
      Crawler/Crawler.cpp

@ -1112,6 +1112,7 @@ geom2d::rect<int>Crawler::GetTileCollision(MapName map,vf2d pos,bool upperLevel)
if(foundRect.pos==NO_COLLISION.pos&&foundRect.size==NO_COLLISION.size){ if(foundRect.pos==NO_COLLISION.pos&&foundRect.size==NO_COLLISION.size){
foundRect=collisionRect; foundRect=collisionRect;
}else{ }else{
//When we find another rectangle in the same square, we expand it to consume the area, whichever tile creates a larger surface or the combination of the two.
foundRect.pos.x=std::min(foundRect.pos.x,collisionRect.pos.x); foundRect.pos.x=std::min(foundRect.pos.x,collisionRect.pos.x);
foundRect.pos.y=std::min(foundRect.pos.y,collisionRect.pos.y); foundRect.pos.y=std::min(foundRect.pos.y,collisionRect.pos.y);
foundRect.size.x=std::max(foundRect.size.x,collisionRect.size.x); foundRect.size.x=std::max(foundRect.size.x,collisionRect.size.x);

Loading…
Cancel
Save