#include <TBullet.h>
Inheritance diagram for TBullet:


Public Methods | |
| TBullet () | |
| Construct a new unused bullet. More... | |
| void | Set (TInt16 aSpriteNo, TInt16 aHealth) |
| Set up the stength and sprite number for this bullet. More... | |
| void | Shoot (TInt16 aX, TInt16 aY) |
| Start the bullet going. More... | |
| void | AddHealth (TInt16 aHealth) |
| Bullet has hit something so remove some health. More... | |
| TInt16 | Health () |
| Current health of bullet. More... | |
| void | Move () |
| move the bullet. More... | |
| TInt16 | Strength () |
| Health of newly created bullet of this type. More... | |
Private Attributes | |
| TInt16 | iHealth |
| amount of damage the bullet will do before it expires. More... | |
| TInt16 | iSavedSpriteNo |
| Sprite to use for this bullet. More... | |
| TInt16 | iSavedHealth |
| Health of a new bullet of this type. More... | |
Definition at line 23 of file TBullet.h.
|
|
Construct a new unused bullet.
Definition at line 19 of file TBullet.cpp.
00019 : iSavedSpriteNo(-1), iSavedHealth(0) { 00020 00021 } |
|
||||||||||||
|
Set up the stength and sprite number for this bullet.
Definition at line 24 of file TBullet.cpp. References iSavedHealth, and iSavedSpriteNo. Referenced by CGame::Bonus(), and CGame::ConstructL().
00024 {
00025 iSavedHealth=aHealth;
00026 iSavedSpriteNo=aSpriteNo;
00027 }
|
|
||||||||||||
|
Start the bullet going.
Definition at line 34 of file TBullet.cpp. References iHealth, iSavedHealth, iSavedSpriteNo, TSprite32x24::iX, TSprite32x24::iY, and TSprite32x24::SetSpriteNo(). Referenced by CGame::Shoot().
00034 {
00035 iX=aX;
00036 iY=aY;
00037 SetSpriteNo(iSavedSpriteNo);
00038 iHealth=iSavedHealth;
00039 }
|
|
|
Bullet has hit something so remove some health. Bullets are damaged by the same amount they damage other ships so the bullet will continue flying until it has damaged ships equal to its initial health or leaves the screen.
Definition at line 49 of file TBullet.cpp. References TSprite32x24::ClearSprite(), and iHealth. Referenced by TBadGuy::HitBullet().
00049 {
00050 iHealth+=aHealth;
00051 if(iHealth <= 0) {
00052 iHealth=0;
00053 ClearSprite();
00054 }
00055 }
|
|
|
Current health of bullet.
Definition at line 61 of file TBullet.cpp. References iHealth. Referenced by TBadGuy::HitBullet().
00061 {
00062 return iHealth;
00063 }
|
|
|
move the bullet. Called for each frame that the bullet has a valid sprite. Ie TSprite32x24::Used() return ETrue. If the bullet leaves the visible part of the screen it is cleared. Definition at line 81 of file TBullet.cpp. References TSprite32x24::ClearSprite(), and TSprite32x24::iX. Referenced by CGame::MoveThings().
00081 {
00082 iX+=8;
00083 if(iX > 296) ClearSprite();
00084 }
|
|
|
Health of newly created bullet of this type.
Definition at line 69 of file TBullet.cpp. References iSavedHealth. Referenced by CGame::Bonus().
00069 {
00070 return iSavedHealth;
00071 }
|
|
|
amount of damage the bullet will do before it expires.
|
|
|
Sprite to use for this bullet.
|
|
|
Health of a new bullet of this type.
|