Yes, the code provided is just for one sprite, sorry about that.
The sprites are loaded through an init function in the DrawCups constructor:
void DrawCups::initSprites()
{
loadImage("./images/InsertionSort/red_cup_1.png", _cup1, _cup1Sprite);
_cup1Sprite.setPosition(200, 230);
_cup1.setSmooth(true);
loadImage("./images/InsertionSort/red_cup_9.png", _cup9, _cup9Sprite);
_cup9Sprite.setPosition(sf::Vector2f(300, 230));
loadImage("./images/InsertionSort/red_cup_3.png", _cup3, _cup3Sprite);
_cup3Sprite.setPosition(sf::Vector2f(450, 230));
loadImage("./images/InsertionSort/red_cup_5.png", _cup5, _cup5Sprite);
_cup5Sprite.setPosition(sf::Vector2f(600, 230));
loadImage("./images/InsertionSort/red_cup_2.png", _cup2, _cup2Sprite);
_cup2Sprite.setPosition(sf::Vector2f(750, 230));
loadImage("./images/InsertionSort/red_cup_8.png", _cup8, _cup8Sprite);
_cup8Sprite.setPosition(sf::Vector2f(900, 230));
}
Each sprite is being drawn via the 'drawCups' function:
void DrawCups::drawCups()
{
_window.draw(_cup1Sprite);
_window.draw(_cup9Sprite);
_window.draw(_cup9Sprite);
_window.draw(_cup3Sprite);
_window.draw(_cup5Sprite);
_window.draw(_cup2Sprite);
_window.draw(_cup8Sprite);
}
I removed the code for the moving of the other cups because it was the exact same function as the .update(), just updateCup3() etc... I've decided to go in the direction of just having one update function that will call the name of the sprite needing to be updated.