SFML community forums
Help => Graphics => Topic started by: The Terminator on August 13, 2012, 01:56:55 am
-
For my collision detection, is it possible to create a sprite and assign it a sf::Rect<int> for collision checking? If this is possible, would it be easier and more simple than comparing the height + width with just a sprite? I know you can use contains to see if two rects are intersecting, but how would I use it with a sprite?
-
sprite.getGlobalBounds() (http://www.sfml-dev.org/documentation/2.0/classsf_1_1Sprite.php#a203d2d8087bfdca2ebc3c0485cdb7409) will return a sf::FloatRect which you then can test against other rects or points to check for collision. ;)
-
Ah yes, of course ;D hadn't even thought of that, thanks.