![]() |
Top-down Shooter With Death
A Top-Down Shooter in Which Characters Die
|
The game object. More...
#include <Object.h>
Public Member Functions | |
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... | |
const Vector2 | GetViewVector () const |
Compute view vector. More... | |
Protected Attributes | |
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. | |
Friends | |
class | CObjectManager |
Object manager needs access so it can manage. | |
Additional Inherited Members | |
![]() | |
static LSpriteRenderer * | m_pRenderer = nullptr |
Pointer to renderer. | |
static CObjectManager * | m_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 CPlayer * | m_pPlayer = nullptr |
Pointer to player character. | |
The abstract representation of an object. CObjectManager
is a friend of this class so that it can access any private members as needed to manage the objects without the need for reader and set functions for each private or protected member variable. This class must contain public member functions move()
and draw()
to move and draw the object, respectively.
CObject::CObject | ( | eSprite | t, |
const Vector2 & | p | ||
) |
Create and initialize an object given its sprite type and initial position.
t | Type of sprite. |
p | Initial position of object. |
|
protectedvirtual |
|
protectedvirtual |
void CObject::draw | ( | ) |
Ask the renderer to draw the sprite described in the sprite descriptor. Note that CObject
is derived from LBaseObject
which is inherited from LSpriteDesc2D
. Therefore LSpriteRenderer::Draw(const LSpriteDesc2D*)
will accept this
as a parameter, automatically down-casting it from CObject*
to LSpriteDesc2D*
, effectively drawing the object from its sprite descriptor.
|
protected |
Compute the view vector from the object orientation.
const bool CObject::isBullet | ( | ) | const |
Reader function for bullet flag.
void CObject::move | ( | ) |
Move object an amount that depends on its velocity and the frame time.