home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / xenon / source / rushergenerator.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-07-20  |  1.2 KB  |  65 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    CRusherGenerator
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    06/05/00
  8. //
  9. // Base:    CActor
  10. //
  11. // Derived:    None
  12. //
  13. //-------------------------------------------------------------
  14.  
  15. #include "game.h"
  16.  
  17. //-------------------------------------------------------------
  18.  
  19. CRusherGenerator::CRusherGenerator()
  20. {
  21.     m_rushers_created = 0;
  22. }
  23.  
  24. //-------------------------------------------------------------
  25.  
  26. CRusherGenerator::~CRusherGenerator()
  27. {
  28. }
  29.  
  30. //-------------------------------------------------------------
  31.  
  32. bool CRusherGenerator::activate()
  33. {
  34.     if (!isActive()) {
  35.         m_timer.start();
  36.         m_delay_timer.start();
  37.         }
  38.  
  39.     return CActor::activate();
  40. }
  41.  
  42. //-------------------------------------------------------------
  43.  
  44. bool CRusherGenerator::update(Controls *controls)
  45. {
  46.     if (m_delay_timer.getTime() < RUSHER_DELAY)
  47.         return true;
  48.  
  49.     m_delay_timer.start();
  50.     
  51.     CRusher *r = new CRusher;
  52.     m_scene->addActor(r);
  53.     r->setPosition(getPosition());
  54.     r->setVelocity(getVelocity());
  55.     r->activate();
  56.  
  57.     m_rushers_created++;
  58.     if (m_rushers_created >= RUSHER_TOTAL)
  59.         kill();
  60.  
  61.     return true;
  62. }
  63.  
  64. //-------------------------------------------------------------
  65.