SFML community forums
Help => Graphics => Topic started by: arkus on July 28, 2013, 05:31:54 pm
-
Hi!
I'm looking for an easier way to manage the collosion of two sprites. at the moment, i use sprite.getposition().x/y of each sprite and compare the values with a certain tolerance:
(http://i1244.photobucket.com/albums/gg573/mondscheinprimat/collision.jpg)
Is there a function which compares the alpha channel of two sprites and spots a collision of them?
i need it especially for the collsion of round objects.
-
Nope sorry, the only built in collision functions are with IntRect to check for collision or intersection. For any other shapes you'll need to do your own
-
IF you know for sure that the two objects are circles, you know that there is a collision is the distance of the two centers is less than, or equal, to the sum of the two radiuses. It will be much faster than doing complex pixel-perfect collision detection.
-
IF you know for sure that the two objects are circles, you know that there is a collision is the distance of the two centers is less than, or equal, to the sum of the two radiuses. It will be much faster than doing complex pixel-perfect collision detection.
nice hint, i think this will work in most cases. thank you!