Top-down Shooter With Death
A Top-Down Shooter in Which Characters Die
Public Member Functions | Protected Member Functions | List of all members
CBullet Class Reference

The bullet object. More...

#include <Bullet.h>

Inheritance diagram for CBullet:
CObject CCommon

Public Member Functions

 CBullet (eSprite t, const Vector2 &p)
 Constructor. More...
 
- Public Member Functions inherited from CObject
 CObject (eSprite, const Vector2 &)
 Constructor. More...
 
virtual ~CObject ()
 Destructor.
 
void move ()
 Move object. More...
 
void draw ()
 Draw object. More...
 
const bool isBullet () const
 Is a bullet. More...
 

Protected Member Functions

virtual void CollisionResponse (const Vector2 &, float, CObject *=nullptr)
 Collision response. More...
 
virtual void DeathFX ()
 Death special effects. More...
 
- Protected Member Functions inherited from CObject
const Vector2 GetViewVector () const
 Compute view vector. More...
 

Additional Inherited Members

- Protected Attributes inherited from CObject
float m_fRadius = 0
 Bounding circle radius.
 
float m_fSpeed = 0
 Speed.
 
float m_fRotSpeed = 0
 Rotational speed.
 
Vector2 m_vVelocity
 Velocity.
 
bool m_bStatic = true
 Is static (does not move).
 
bool m_bIsTarget = true
 Is a target.
 
bool m_bIsBullet = false
 Is a bullet.
 
LEventTimer * m_pGunFireEvent = nullptr
 Gun fire event.
 
- Static Protected Attributes inherited from CCommon
static LSpriteRenderer * m_pRenderer = nullptr
 Pointer to renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to object manager.
 
static LParticleEngine2D * m_pParticleEngine = nullptr
 Pointer to particle engine.
 
static bool m_bGodMode = false
 God mode flag.
 
static Vector2 m_vWorldSize = Vector2::Zero
 World height and width.
 
static CPlayerm_pPlayer = nullptr
 Pointer to player character.
 

Detailed Description

The abstract representation of a bullet object. Bullet objects die in a cloud of smoke when they collide with anything.

Constructor & Destructor Documentation

◆ CBullet()

CBullet::CBullet ( eSprite  t,
const Vector2 &  p 
)

Create and initialize a bullet object given its initial position.

Parameters
tSprite type of bullet.
pInitial position of bullet.

Member Function Documentation

◆ CollisionResponse()

void CBullet::CollisionResponse ( const Vector2 &  norm,
float  d,
CObject pObj = nullptr 
)
protectedvirtual

Response to collision, which for a bullet means playing a sound and a particle effect, and then dying.

Parameters
normCollision normal.
dOverlap distance.
pObjPointer to object being collided with (defaults to nullptr).

Reimplemented from CObject.

◆ DeathFX()

void CBullet::DeathFX ( )
protectedvirtual

Create a smoke particle effect to mark the death of the bullet.

Reimplemented from CObject.