00001 // Copyright 2002 Kenneth Guy, 00002 // 00003 // You are free to take the source and do as you wish with it. 00004 // However it would be nice if you let me know if the code was useful 00005 // to you and give me an acknowledgement if you use a significant portion 00006 // of the code in an application. 00007 // 00008 // CGame.h 00009 00010 #ifndef _CGAME_H_ 00011 #define _CGAME_H_ 00012 00017 #include <e32std.h> 00018 00019 #include "CMap.h" 00020 #include "RScreenUtils.h" 00021 #include "RStatus.h" 00022 #include "TLevelData.h" 00023 00024 class TSprite32x24; 00025 class TBadGuy; 00026 class TPlayersShip; 00027 class TBullet; 00028 class TGameData; 00029 00040 class CGame : public CBase { 00041 public: 00043 enum TGameBonus { 00044 EBonusLife, 00045 EBonusPowerup 00046 }; 00047 00048 00049 public: 00050 static CGame* NewL(TGameData& aData); 00051 ~CGame(); 00052 00053 void Play(); 00054 void AddBadGuy(TInt16 aType,const TInt16 aArgs[]); 00055 void AddBadGuy(const TBadGuy &aBadGuy); 00056 void Bonus(TGameBonus aBonus); 00057 void AddScore(TInt aScore); 00058 void DamageBadGuys(TInt16 aId,TInt16 aHealth); 00059 TInt16 FirstExplosionSprite(); 00060 TInt16 LastExplosionSprite(); 00061 TInt16 MapSpeed(); 00062 00063 private: 00064 CGame(TGameData& aData); 00065 void ConstructL(); 00066 00067 void Collisions(); 00068 void RemoveEveryThing(); 00069 void DrawEveryThing(); 00070 void MoveThings(); 00071 void HandleKeys(); 00072 void Shoot(); 00073 00074 private: 00075 TGameData& iData; 00076 TPlayersShip* iPlayersShip; 00077 TBadGuy* iBadGuys; 00078 TBullet* iBullets; 00079 TInt iLastFired; 00080 CMap* iMap; 00081 RStatus iStatus; 00082 TInt iPowerups; 00083 }; 00084 00085 #endif