home *** CD-ROM | disk | FTP | other *** search
/ Game Programming - All in One (3rd Edition) / game_prog_all_in_one_3rd_ed.iso / sources / chapter10 / AngularMotion / sprite.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-09-14  |  802 b   |  40 lines

  1. #ifndef _SPRITE_H
  2. #define _SPRITE_H 1
  3.  
  4. #include <allegro.h>
  5.  
  6. class sprite {
  7. private:
  8. public:
  9.     int alive;
  10.     int state;
  11.     int objecttype;
  12.     int direction;
  13.     double x,y;
  14.     int width,height;
  15.     double speed;
  16.     double velx, vely;
  17.     int xdelay,ydelay;
  18.     int xcount,ycount;
  19.     int curframe,totalframes,animdir;
  20.     int framecount,framedelay;
  21.     int animcolumns;
  22.     int animstartx, animstarty;
  23.     int faceAngle, moveAngle;
  24.     BITMAP *image;
  25.  
  26. public:
  27.     sprite();
  28.     ~sprite();
  29.     int load(char *filename);
  30.     void draw(BITMAP *dest);
  31.     void drawframe(BITMAP *dest);
  32.     void updatePosition();
  33.     void updateAnimation();
  34.     int inside(int x,int y,int left,int top,int right,int bottom);
  35.     int pointInside(int px,int py);
  36.     int collided(sprite *other = NULL, int shrink = 5);
  37. };
  38.  
  39. #endif
  40.