File: Sprite.h

package info (click to toggle)
hannah 1.0-3.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 8,932 kB
  • sloc: cpp: 2,170; makefile: 81
file content (46 lines) | stat: -rw-r--r-- 953 bytes parent folder | download | duplicates (3)
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