The Tricycle's Ninja
|
00001 #ifndef _ANIMATEDPLAYER_H_ 00002 #define _ANIMATEDPLAYER_H_ 00003 00004 // Definimos Animation como un vector de imagenes 00005 typedef std::vector<std :: tr1 :: shared_ptr<Gosu::Image> > Animation; 00006 00010 class AnimatedPlayer 00011 { 00012 Animation& animation; 00013 double posX, posY, velX, velY; 00014 int angle; 00015 00016 public: 00021 AnimatedPlayer(Animation& anima): animation(anima) 00022 { 00023 posX = posY = velX = velY = angle = 0; 00024 } 00028 void draw() const 00029 { 00030 Gosu::Image& image = * animation.at(Gosu::milliseconds() / 150 % animation.size()); 00031 image.drawRot(posX,posY,3,angle, 0.5,0.5,0.5,0.5); 00032 } 00039 void cambios(double px, double py, int a) 00040 { 00041 posX=px;posY=py;angle=a; 00042 } 00043 }; 00044 #endif /*_ANIMATEDPLAYER_H_*/ 00045