SFML community forums
Help => Graphics => Topic started by: Mattio91 on January 12, 2011, 01:49:25 pm
-
Hi,
I am working on project where I can't use library with collision, so I do it my self and I am wondering does is there some way to add a point to sprite (something like Center but usable only for me). What's important point should rotate and moving with sprite. It's my second project and my English is not so god so be tolerant and explain me how to do it. Thx
-
There are several possibilities to achieve what you want. The simplest way is probably a sf::Shape circle (modeling the point) which is drawn over the sf::Sprite. The problem with this approach is that all the attributes (position, rotation, scale, color) of the two objects must be kept consistent manually. This problem can be solved by a sf::Drawable that holds a sf::Sprite and a sf::Shape as member and draws them in its Render() function.
You could also modify the sf::Image directly (set its pixel colors), but then that applies to all sprites using that image.