Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to generate multiple animated sprites  (Read 1063 times)

0 Members and 1 Guest are viewing this topic.

WDR

  • Jr. Member
  • **
  • Posts: 82
    • View Profile
How to generate multiple animated sprites
« on: March 10, 2015, 10:00:58 pm »
Hi... I want to show multiple animated sprites of the same texture on the screen (Enemy sprites, if you will). I know that to generate multiple inanimate sprites of same texture, we use std::list<sf::Sprite> or std::vector<sf::Sprite> or any STL container of choice. I am using the Animated Sprite Class given here: https://github.com/SFML/SFML/wiki/Source:-AnimatedSprite.

So, according to that class, we are no longer setting textures directly to sprites, but via instances of Animation class declared in the main() for each movement. Also, there is one pointer instance of Animation class which points to the current animation based on various conditions. Finally, there is an instance of AnimatedSprite which plays (animates) the current animation and this instance is what is drawn in the Window. Can anyone tell me how I would get multiple animated sprites on screen without declaring an AnimatedSprite instance for every single one of them? Please help. Thank you.  :)