Hi all,
Yesterday I download SFML 2.3 and started writing my first pong game. However I am having some issues with Bounding Boxes when it comes to collision detection.
I have been using the tutorials that are provided so far. I can create two paddles and a ball. However the player movable Paddle goes off the screen when in reality I want it to stop. Looking at the bounding box example, I cant see how I would use this with screen coordinates. Any help would be appreciated.
I can see how to look for collisions between object (I think). But the paddle going off the screen is baffling me.
// get the bounding box of the entity
sf::FloatRect boundingBox = entity.getGlobalBounds();
// check collision with a point
sf::Vector2f point = ...;
if (boundingBox.contains(point))
{
// collision!
}