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