home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / demos / skyscrap / build / weapon.h < prev   
Encoding:
C/C++ Source or Header  |  1995-04-13  |  1.1 KB  |  45 lines

  1. #ifndef __weapon_h
  2. #define __weapon_h
  3.  
  4. #include "object.h"
  5.  
  6. //--------------------------------------
  7. // WeaponImage
  8. // enumerations for weapon images
  9. //--------------------------------------
  10. enum WeaponImage
  11. {
  12.   wiLEFT, wiNORMAL, wiRIGHT, wiEXPLODE1, wiEXPLODE2, wiEXLODE3
  13. };
  14.  
  15. //--------------------------------------
  16. // Weapon
  17. // a weapon
  18. // maintains a current image index
  19. // draws itself
  20. //--------------------------------------
  21. class Weapon : public Object
  22. {
  23.   // data
  24.   private:
  25.   protected:
  26.     boolean active;     // is weapon on screen?
  27.     WeaponImage image;  // the current image of the weapon
  28.   public:
  29.  
  30.   // functions
  31.   private:
  32.   protected:
  33.   public:
  34.     Weapon()                      { image=wiNORMAL, active=NO;    }
  35.     virtual void OnDraw(void)     {} // draws weapon's image
  36.     virtual boolean Move(void)=0;
  37.     virtual boolean CheckForCollision()=0;
  38.     boolean IsActive()            { return active;                }
  39.     void Deactivate(void)         { active=NO;                    }
  40.     void Activate( int X, int Y ) { active=YES, loc.x=X, loc.y=Y; }
  41.  
  42. };
  43.  
  44. #endif //__weapon_h
  45.