spacechase0

Collision thing

Nov 10th, 2013
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1.  
  2.         sf::IntRect tileRect;
  3.         tileRect.left = ( pos.x - ( getBoundingBox().width / 2.f ) ) - 2;
  4.         tileRect.top = ( pos.y - ( getBoundingBox().height / 2.f ) ) - 2;
  5.         tileRect.width = getBoundingBox().width + 4;
  6.         tileRect.height = getBoundingBox().height + 4;
  7.        
  8.         // I don't remember what these were for. Probably for checking if there was a collision
  9.         sf::Vector2i vertCol( -1073741824, -1073741824 );
  10.         sf::Vector2i horCol( -1073741824, -1073741824 );
  11.        
  12.         for ( int ix = tileRect.left; ix < tileRect.left + tileRect.width; ix++ )
  13.         {
  14.             for ( int iy = tileRect.top; iy < tileRect.top + tileRect.height; iy++ )
  15.             {
  16.                 // Stuff
  17.             }
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment