SFML community forums
Help => Graphics => Topic started by: on September 11, 2010, 12:52:08 pm
-
Hi, i'm a beginner , my problem is : i have two containers each having (sf::Shape) objects , my code is something like this:
//imagine two containers with iter1 is for container 1 and iter2 for the second
for(//traverse first container)
{
for(//traverse second container)
{
if((iter1->getColor() == iter2->getColor()) && (col_det(//pass)))
//do something
}
}
the collision detection works fine (simple circle method ) but the color part is not working, i.e. it collides regardless of the color.WHY?
please help me and remember i'm still a beginner and stupid.
thanks in advance.
-
Remember that the color that you pass to the sf::Shape::Circle function is assigned to each points of the shape, and is different from the global color that you get with GetColor.
-
WOW :D thank you, it worked , i was passing the color to the constructor only , i must have used setColor function, thank you again :P