The Top Down Game Prototype
A Basic Top Down Shooter
Loading...
Searching...
No Matches
CBullet Class Reference

The bullet object. More...

#include <Bullet.h>

Inheritance diagram for CBullet:
Collaboration diagram for CBullet:

Public Member Functions

 CBullet (eSprite, const Vector2 &)
 Constructor.
 
void Move ()
 Move bullet.
 
- Public Member Functions inherited from CObject
 CObject (eObject, eSprite, const Vector2 &)
 Constructor.
 
virtual ~CObject ()
 Destructor.
 
virtual void Draw ()
 Draw object.
 
const eObject GetType () const
 Get object type.
 

Protected Member Functions

void CollisionResponse (const Vector2 &, float, CObject *=nullptr)
 Collision response.
 
void DeathFX ()
 Death special effects.
 
void DeathFX (eObject)
 Death special effects.
 

Protected Attributes

Vector2 m_vVelocity
 Velocity.
 
- Protected Attributes inherited from CObject
eObject m_eObject = eObject::Unknown
 Object type.
 
eSprite m_eSprite = eSprite::Player
 Sprite type.
 
Vector2 m_vPos
 Position.
 
float m_fRoll = 0
 Roll angle.
 
float m_fRadius = 0
 Bounding circle radius.
 

Friends

class CObjectManager
 Object manager needs access so it can manage.
 

Additional Inherited Members

- Static Protected Attributes inherited from CCommon
static Sage::CSpriteRenderer * m_pRenderer = nullptr
 Pointer to renderer.
 
static CObjectManagerm_pObjectManager = nullptr
 Pointer to object manager.
 
static Sage::CParticleEngine2D * m_pParticleEngine = nullptr
 Pointer to particle engine.

 
static CPlayerm_pPlayer = nullptr
 Pointer to player character.
 
static bool m_bGodMode = false
 God mode flag.
 
static bool m_bShowState = false
 Show NPC state flag.
 
static bool m_bShowBounds = false
 Show collision circle flag.
 

Detailed Description

The abstract representation of a bullet object. Bullet objects die in a cloud of smoke when they collide with a wall and a blood spatter when they collide with anything else.

Constructor & Destructor Documentation

◆ CBullet()

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

Create and initialize a bullet object given its initial position.

Parameters
sprSprite enumerated type.
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.

Here is the call graph for this function:

◆ DeathFX() [1/2]

void CBullet::DeathFX ( )
protected

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

Here is the caller graph for this function:

◆ DeathFX() [2/2]

void CBullet::DeathFX ( eObject t)
protected

Create a particle effect to mark the death of the bullet depending on the type of object that it collided with.

Parameters
tObject type of impacted object.

◆ Move()

void CBullet::Move ( )
virtual

Move bullet an amount that depends on its velocity and the frame time.

Reimplemented from CObject.