Hi, what I want to do is check for collision of an sf::FloatRect between any other sf::FloatRect stored in a vector. I don't know how one would do this really. I would of thought you could use a for loop but I'm not sure :-\
std::vector<sf::FloatRect>myFloatRects(100); // 100 floatRects of sf::Shape
sf::FloatRect myPosition = myShape.getGlobalBounds();
if (myPosition.intersects(myFloatRects)){ // if myPosition intersects any of myFloatRects
//do something
}
hi, when you need to check any kind of container like a vector or an array you need to loop it , for example :
std::vector<sf::FloatRect>myFloatRects(100); // 100 floatRects of sf::Shape
sf::FloatRect myPosition = myShape.getGlobalBounds();
for(int i = 0; i = myFloatRects.size();i++)
if (myPosition.intersects(myFloatRects[i])){ // if myPosition intersects any of myFloatRects
//do something
}
}