![]() |
Top-down Shooter With Death
A Top-Down Shooter in Which Characters Die
|
The player object. More...
#include <Player.h>
Public Member Functions | |
CPlayer (const Vector2 &p) | |
Constructor. More... | |
virtual void | move () |
Move player object. More... | |
void | SetSpeed (const float speed) |
Set speed. More... | |
void | SetRotSpeed (const float speed) |
Set rotational velocity. More... | |
void | StrafeLeft () |
Strafe left. More... | |
void | StrafeRight () |
Strafe right. More... | |
void | StrafeBack () |
Strafe back. More... | |
const Vector2 & | GetPos () const |
Get position. More... | |
![]() | |
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 | |
const UINT | m_nMaxHealth = 12 |
Maximum health. | |
UINT | m_nHealth = m_nMaxHealth |
Current health. | |
bool | m_bStrafeLeft = false |
Strafe left. | |
bool | m_bStrafeRight = false |
Strafe right. | |
bool | m_bStrafeBack = false |
Strafe back. | |
![]() | |
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. | |
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 the player object. The player differs from the other objects in the game in that it moves in respond to device inputs.
CPlayer::CPlayer | ( | const Vector2 & | p | ) |
Create and initialize an player object given its initial position.
p | Initial position of player. |
|
protectedvirtual |
Response to collision. If the object being collided with is a bullet, then play a sound, otherwise call CObject::CollisionResponse
for the default collision response.
norm | Collision normal. |
d | Overlap distance. |
pObj | Pointer to object being collided with (defaults to nullptr , which means collision with a wall). |
Reimplemented from CObject.
|
protectedvirtual |
Perform a particle effect to mark the death of the player.
Reimplemented from CObject.
const Vector2 & CPlayer::GetPos | ( | ) | const |
Reader function for position.
|
virtual |
Move and rotate in response to device input. The amount of motion and rotation speed is proportional to the frame time.
void CPlayer::SetRotSpeed | ( | const float | speed | ) |
Set the object's rotational speed in revolutions per second. This function will be called in response to device inputs.
speed | Rotational speed in RPS. |
void CPlayer::SetSpeed | ( | const float | speed | ) |
Set the object's speed, assuming that the object moves in the direction of its view vector. This function will be called in response to device inputs.
speed | Speed. |
void CPlayer::StrafeBack | ( | ) |
Set the strafe back flag. This function will be called in response to device inputs.
void CPlayer::StrafeLeft | ( | ) |
Set the strafe left flag. This function will be called in response to device inputs.
void CPlayer::StrafeRight | ( | ) |
Set the strafe right flag. This function will be called in response to device inputs.