Hi folks! I'm very new to SFML, and this is my first time posting. If I'm asking a stupid question in the wrong place, let me know and I'll do my best to fix it.
So, I've implemented the simple collision detection module (
http://www.sfml-dev.org/wiki/en/sources/simple_collision_detection), and it works just fine. I have a number of sprites for walls, and a sprite for the player, and when the player walks into the wall he stops. No problems there.
I decided I wanted to make a transparent sprites with collision. These would represent traps on the floor that the player can't see. I used .SetColor to set the alpha for the sprite down to 0, making it transparent. But for some reason that I can't figure out, this removed all collision detection. In fact, any alpha value below 128 removes collision detection.
I can't for the life of me figure out why. The alpha doesn't make any changes to the 'math' behind the detection. It's purely visual. Is there something I'm missing?
The code I'm using to change alpha is:
wall_left->set_colour(255,255,255,128);
Which feeds into:
void VisibleGameObject::set_colour(float red, float blue, float green, float alpha)
{
_sprite.SetColor(sf::Color(red, blue, green, alpha));
}
Nothing exciting, but I figure I should post it for completeness.