The Game Engine  1
Sprite.h
Go to the documentation of this file.
1 #ifndef __SPRITE_H__
2 #define __SPRITE_H__
3 #include <SDL/SDL.h>
4 #include <string>
5 #include "fns.h"
6 #include "Actor.h"
7 #include "WorldObject.h"
8 
20 class Sprite : public WorldObject
21 {
22 public:
23  Sprite(std::string name, Actor actor, bool menuSprite=false);
24  ~Sprite();
25 
30  void setAnimation(int animation) { mActor.CurrentAnimation = animation; }
31 
37 
42  void setFrame(int frame) { mActor.Frame = frame; }
43 
48  int getFrame() { return mActor.Frame; }
49 
54  void setSpeed(float speed) { mSpeed = speed; }
55 
60  float getSpeed() { return mSpeed;}
61 
66 
70  void startAnim() { mAnimating = 1; }
71 
75  void stopAnim() { mAnimating = 0; }
76 
80  void rewind() { mActor.Frame = 0; }
81 
85  void draw();
86 
90  void drawCollisions();
91 
95  virtual void update();
96 
100  virtual void runBehavior();
101 
105  vector<Sprite*> collisionWithSprites(string name, int count = -1);
106 
110  vector<CollisionObject*>& getCollisionData();
111 
116 
121 
125  virtual WorldObjectType getType(){ return SPRITE; }
126 
127 protected:
130 
132  bool mDrawn;
133 
135  float mSpeed;
136 
139 };
140 #endif