home *** CD-ROM | disk | FTP | other *** search
/ C++ Games Programming / CPPGAMES.ISO / thx / demos / skyscrap / build / health.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-13  |  430 b   |  24 lines

  1. #include "health.h"
  2. #include "gfx.h"
  3.  
  4. void Health::initialize()
  5. {
  6.   load_gfxlib( "ss.gfx" );
  7. }
  8.  
  9. void Health::minus( int PercentLoss, boolean UpdateScreen )
  10. {
  11.   percent-=PercentLoss;
  12.   if ( UpdateScreen )
  13.     draw();
  14. }
  15.  
  16. void Health::draw(void)
  17. {
  18.   int x=4;
  19.   int ColorId=percent>20 ? HEALTH_GREEN:percent>10 ? HEALTH_YELLOW:HEALTH_RED;
  20.   for ( int i=0; i<percent; i++ )
  21.     show_image( x++, 4, ColorId );
  22. }
  23.  
  24.