Skip to content

Instantly share code, notes, and snippets.

@travisperson
Created April 22, 2012 02:55
Show Gist options
  • Save travisperson/2443889 to your computer and use it in GitHub Desktop.
Save travisperson/2443889 to your computer and use it in GitHub Desktop.
sf::IntRect thisFutureRect = sf::IntRect(obj.X() + (int)obj.getVelocity().x * dTime, obj.Y() + (int)obj.getVelocity().y * dTime, obj.getBoundingBox().width, obj.getBoundingBox().height);
sf::IntRect objFutureRect = sf::IntRect(collideWith.X() + (int)collideWith.getVelocity().x * dTime, collideWith.Y() + (int)collideWith.getVelocity().y * dTime, collideWith.getBoundingBox().width, collideWith.getBoundingBox().height);
sf::IntRect intersect;
thisFutureRect.intersects(objFutureRect, intersect);
// hitting the side of something
/*if (((obj_y + (ObjBox.height / 2)) >= ((collideWith_y + (CollideBox.height / 2)) - (CollideBox.height)))
&& ((obj_y + (ObjBox.height / 2)) <= ((collideWith_y + (CollideBox.height / 2)) + (CollideBox.height))))
{*/
if ( intersect.height > intersect.width )
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment