When you say 'can only return a single sprite' I'm assuming you're doing something like
renderWindow.draw(robot.getSprite());
If this is the case a better approach would be to look at the
sf::Drawable class. You can then do something like this:
class Robot : public sf::Drawable
{
public:
Robot();
private:
sf::Sprite m_robotSprite;
sf::Sprite m_fireSprite;
void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
}
and:
void Robot::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
target.draw(m_robotSprite);
if(onFire) target.draw(m_fireSprite);
}
and then to draw your robot you only need do:
renderWindow.draw(robot);
You can then draw multiple sprite members within your robot class. If you're concerned about using multiple sprites from a performance point of view, however, you can replace all the sprites with a single vertex array, drawing only parts of a sprite sheet containing both the robot and fire texture as needed (the
vertex array tutorial goes more into this).