00001 #pragma once 00002 #include "sprite.h" 00003 #include <vector> 00004 #include <string> 00005 #include "parser.h" 00006 #include "List.h" 00007 00008 struct SpriteTime 00009 { 00010 Sprite* s; 00011 int time; 00012 }; 00013 00014 class AnimatedSprite : public Sprite 00015 { 00016 public: 00017 //AnimatedSprite(std::string filename); 00018 //AnimatedSprite(std::string filename, int width, int height); 00019 AnimatedSprite( std::string filename, List *spriteInfo ); 00020 AnimatedSprite(AnimatedSprite *sprite); 00021 ~AnimatedSprite(); 00022 00023 Sprite* instance(); 00024 00025 virtual void update(); 00026 virtual void draw(int x, int y, bool origin = LEVEL); 00027 virtual void reset() {_index = 0; _time = 0;} 00028 00029 protected: 00030 std::vector<Sprite*> _createdSprites; 00031 std::vector<SpriteTime> _sprites; 00032 int _index; 00033 int _time; 00034 int _totalTime; 00035 bool _loop; 00036 };