SFML community forums
Help => Graphics => Topic started by: DejectedAxe on April 06, 2015, 07:40:46 pm
-
Hi, basically I want to know if you are able to add a value to a sprite. It is likely unlikely, but basically I what I want is a "moved" value. If my sprite moved I want to set the sprites "moved" value to true. The reason in not just creating a value outside of the sprite for it is that the function returns the sprite, so I can't also return a bool.
-
No, you cannot.
Return a class object that contains both the sprite and the bool. Or simply std::pair (although a user-defined class is more expressive). Alternatively, use an output parameter.
-
Create your own entity class that lets you do such a thing.
-
Thanks, I just wanted to see if it was possible, but both of your options are easy enough.