Hello, I'm trying to make a simple game that needs to detect when one sprite touches another's bounding box, but I don't quite understand the code for this. Sorry if this has already been posted, but I could not find any help. The bit I don't understand is
// check collision with another box (like the bounding box of another entity)
sf::FloatRect otherBox = ...; //What goes here??
if (boundingBox.intersects(otherBox))
{
//collision
}
I did that, but it seems to intersect all the time when it is no where near the sprite. I have this code:
sf::FloatRect helib = heli.getGlobalBounds();
sf::FloatRect obs1b = obs1.getGlobalBounds();
...
if (helb.intersects(obs1b))
{
window.close();
}