1 #ifndef _SPRITE_H_ 2 #define _SPRITE_H_ 3 4 //#include "Animation.h" 5 #include "AnimationFactory.h" 6 7 using namespace std; 8 9 class Sprite{ 10 public: 11 Sprite(char* filename, AnimationFactory* af); // Load all sprites in directory 12 virtual ~Sprite(); 13 SDL_Surface* frame(); 14 void loadAnimation(char *animName, bool loop); 15 bool isAnimation(char* name); 16 char* getAnimation(); 17 void setAnimation(char *name); 18 bool animationFinished(); 19 void kill(); 20 void x(int x); // Set X 21 void y(int y); 22 int x(); // Get X 23 int y(); 24 void gridx(int x); 25 void gridy(int y); 26 void move(); 27 int nextxpos; 28 int nextypos; 29 int direction; // 1 = up, 2 = down, 3 = left, 4 = right, 5 = stationary 30 bool alive; 31 32 protected: 33 vector<Animation*> animations; 34 Animation* current; 35 AnimationFactory* af; 36 char* name; 37 int xpos; 38 int ypos; 39 int gridxpos; 40 int gridypos; 41 int currentframe; 42 int speed; 43 int delay; 44 }; 45 46 #endif 47