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

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    CExplosion
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    06/05/00
  8. //
  9. // Base:    CAlien
  10. //
  11. // Derived:    CSmallExplosion
  12. //            CMediumExplosion
  13. //            CBigExplosion
  14. //
  15. //-------------------------------------------------------------
  16.  
  17. #include "game.h"
  18.  
  19. //-------------------------------------------------------------
  20.  
  21. CExplosion::CExplosion()
  22. {
  23. }
  24.  
  25. //-------------------------------------------------------------
  26.  
  27. CExplosion::~CExplosion()
  28. {
  29. //    CActor::~CActor();
  30. }
  31.  
  32. //-------------------------------------------------------------
  33.  
  34. bool CExplosion::activate()
  35. {
  36.     if (!isActive()) {
  37.         m_timer.start();
  38.         }
  39.  
  40.     return CActor::activate();
  41. }
  42.  
  43. //-------------------------------------------------------------
  44.  
  45. bool CExplosion::update(Controls *controls)
  46. {
  47.     m_position += m_velocity;
  48.  
  49.     if (animate(ANIMATE_ONESHOT))
  50.         kill();
  51.     
  52.     return true;
  53. }
  54.  
  55. //-------------------------------------------------------------
  56.  
  57. void CExplosion::onLeavingScreen()
  58. {
  59.     kill();
  60. }
  61.  
  62. //-------------------------------------------------------------
  63.  
  64. bool CSmallExplosion::activate()
  65. {
  66.     CGameState::playSample(SAMPLE_SMALL_EXPLOSION,getPosition().getX());
  67.  
  68.     return CExplosion::activate();
  69. }
  70.  
  71. //-------------------------------------------------------------
  72.  
  73. bool CMediumExplosion::activate()
  74. {
  75.     CGameState::playSample(SAMPLE_MEDIUM_EXPLOSION,getPosition().getX());
  76.  
  77.     return CExplosion::activate();
  78. }
  79.  
  80. //-------------------------------------------------------------
  81.  
  82. bool CBigExplosion::activate()
  83. {
  84.     CGameState::playSample(SAMPLE_BIG_EXPLOSION,getPosition().getX());
  85.  
  86.     return CExplosion::activate();
  87. }
  88.  
  89. //-------------------------------------------------------------
  90.