Bonus.cpp
上传用户:royluo
上传日期:2007-01-05
资源大小:1584k
文件大小:3k
源码类别:

游戏

开发平台:

Visual C++

  1. /*****************************************************************************
  2. *                                                                             
  3. *   Bonus.cpp                                                            
  4. *                                                                             
  5. *   Electrical Engineering Faculty - Software Lab                             
  6. *   Spring semester 1998                                                      
  7. *                                                                             
  8. *   Tanks game                                                                
  9. *                                                                             
  10. *   Module description: Implements the bonus object.
  11. *                       
  12. *                                                                             
  13. *   Authors: Eran Yariv - 28484475                                           
  14. *            Moshe Zur  - 24070856                                           
  15. *                                                                            
  16. *                                                                            
  17. *   Date: 23/09/98                                                           
  18. *                                                                            
  19. ******************************************************************************/
  20. #include "stdafx.h"
  21. #include "Tanks.h"
  22. #include "Bonus.h"
  23. CBonus::CBonus (BonusType type, CPoint& pos, DWORD lifespan, DWORD StartTime) : 
  24.     m_Type(type),
  25.     m_uLifeSpan(lifespan)
  26. {
  27.     m_uStartTime = StartTime;
  28.     m_Pos = pos;
  29.     m_Size.cx = BONUS_WIDTH;
  30.     m_Size.cy = BONUS_HEIGHT;
  31.     CImageManager::ImageType ImageType = CImageManager::IMG_LAST_INDEX;
  32.     switch (type) {
  33.         case BONUS_SHELLS:
  34.             ImageType = CImageManager::IMG_BONUS_SHELLS;
  35.             break;           
  36.         case BONUS_BULLETS:
  37.             ImageType = CImageManager::IMG_BONUS_BULLETS;
  38.             break;
  39.         case BONUS_MINES:
  40.             ImageType = CImageManager::IMG_BONUS_MINES;
  41.             break;
  42.         case BONUS_BOMBER:
  43.             ImageType = CImageManager::IMG_BONUS_BOMBER;
  44.             break;
  45.         case BONUS_FIRE_RATE:
  46.             ImageType = CImageManager::IMG_BONUS_FIRERATE;
  47.             break;
  48.         case BONUS_SHIELD:
  49.             ImageType = CImageManager::IMG_BONUS_SHIELD;
  50.             break;
  51.         default:    
  52.             ASSERT (FALSE);
  53.     }
  54.     m_hImage = m_GlobalImageManager.GetImage (ImageType);
  55. }