![]() |
The Top-Down Tiled Game Prototype
A Basic Tiled Top-Down Shooter
|
The guard object. More...
#include <Guard.h>


Public Member Functions | |
| CGuard (const Vector2 &, float) | |
| Constructor. | |
| ~CGuard () | |
| Destructor. | |
| void | Move () |
| Move. | |
| void | Draw () |
| Draw. | |
Public Member Functions inherited from CArmedObject | |
| CArmedObject (eObject, eSprite, const Vector2 &, float) | |
| Constructor. | |
| virtual | ~CArmedObject () |
| Destructor. | |
| void | CreateParticle (const Sage::CParticleDesc2D &) |
Public Member Functions inherited from CObject | |
| CObject (eObject, eSprite, const Vector2 &, float=0) | |
| Constructor. | |
| virtual | ~CObject () |
| Destructor. | |
| void | Draw () |
| Draw object. | |
| const eObject | GetType () const |
| Get object type. | |
| const Vector2 & | GetPos () const |
| Get position. | |
Protected Member Functions | |
| const bool | CloseToPlayer (const float) const |
| Is close to player. | |
| void | CollisionResponse (const Vector2 &, float, CObject *=nullptr) |
| Collision response. | |
| void | ChangeState (eState) |
| Change state. | |
| void | DrawState () |
| Draw state text. | |
| const std::wstring | GetStateString () const |
| Get state text. | |
Protected Member Functions inherited from CArmedObject | |
| const Vector2 | GetViewVector () const |
| Compute view vector. | |
| const Vector2 | GetGunOffset () const |
| Get gun offset. | |
| bool | RotateTowards (const Vector2 &) |
| Swivel towards position. | |
| void | DeathFX () |
| Death special effects. | |
Protected Member Functions inherited from CObject | |
Protected Attributes | |
| const UINT | m_nMaxHealth = 4 |
| Maximum health. | |
| UINT | m_nHealth = m_nMaxHealth |
| Current health. | |
| eState | m_eState = eState::Ready |
| Guard state. | |
| Sage::CEventTimer * | m_pFrameEvent = nullptr |
| Frame event timer. | |
| Sage::CEventTimer * | m_pGunFireEvent = nullptr |
| Gun fire event. | |
Protected Attributes inherited from CArmedObject | |
| UINT | m_nHealth = 1 |
| Current health. | |
| float | m_fRotSpeed = 0 |
| Rotational speed. | |
| Vector2 | m_vGunOffset |
| Sprite gun offset. | |
| Sage::CParticleEngine2D * | m_pLocalParticleEngine = nullptr |
| Pointer to particle engine. | |
Protected Attributes inherited from CObject | |
| eObject | m_eObject = eObject::Unknown |
| Object type. | |
| eSprite | m_eSprite = eSprite::Player |
| Sprite type. | |
| float | m_fScale = 1.0f |
| Scale. | |
| Vector2 | m_vPos |
| Position. | |
| float | m_fRoll = 0 |
| Roll angle. | |
| float | m_fRadius = 0 |
| Damage bounding circle radius. | |
| Vector2 | m_vCenterOffset |
| Sprite center offset. | |
| float | m_fCollisionRadius = 0.0f |
| Collision radius. | |
Private Types | |
| enum class | eState { Ready , Reloading } |
| State of mind. More... | |
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 CObjectManager * | m_pObjectManager = nullptr |
| Pointer to object manager. | |
| static Sage::CParticleEngine2D * | m_pParticleEngine = nullptr |
| Pointer to particle engine. | |
| static CTileManager * | m_pTileManager = nullptr |
| Pointer to tile manager. | |
| static CPlayer * | m_pPlayer = nullptr |
| Pointer to player character. | |
| static Vector2 | m_vWorldSize |
| World height and width. | |
| static bool | m_bGodMode = false |
| God mode flag. | |
| static bool | m_bShowState = false |
| Show NPC state flag. | |
| static bool | m_bShowBounds = false |
| Draw bounding boxes and circles flag. | |
The abstract representation of a guard.
|
strongprivate |
Possible states of mind for a guard.
| CGuard::CGuard | ( | const Vector2 & | p, |
| float | d ) |
Create and initialize a guard object given its position.
| p | Position of guard. |
| d | Initial orientation of guard. |
| CGuard::~CGuard | ( | ) |
The destructor deletes the event timers created by the constructor.
|
protected |
Change state and perform any processing associated with entering the new state. Does nothing if there is no change in state, that is, the new state is the same as the current state.
| newState | The new state. |

|
protected |
Player proximity test.
| d | Required distance to player. |

|
protectedvirtual |
Response to collision. If colliding with an object, play a sound.
| 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.

|
virtual |
Draw the sprite offset by the center offset.
Reimplemented from CArmedObject.

|
protected |
Draw the current state as a text string near the guard location on the screen.


|
protected |
Get a string that describes the current state.

|
virtual |
Rotate the guard and fire the gun at at the closest available target if there is one.
Reimplemented from CArmedObject.
