![]() |
Ned's Turkey Farm
A Simple 2.5D Side Scroller
|
The plane object. More...
#include <PlaneObject.h>


Public Member Functions | |
| CPlaneObject () | |
| Default constructor. | |
| CPlaneObject (const Vector3 &) | |
| Constructor. | |
| ~CPlaneObject () | |
| Destructor. | |
| void | Move () |
| Move object. | |
| void | GetGunMuzzle (Vector3 &, Vector3 &) const |
| Get muzzle position and direction. | |
| void | GunFireFx () |
| Gun fire particle effects. | |
| void | SetVel (const Vector3 &) |
| Set velocity. | |
| void | SetRoll (float) |
| Rotate around Z-axis. | |
Public Member Functions inherited from CObject | |
| CObject () | |
| Default constructor. | |
| CObject (eSprite, const Vector3 &) | |
| Constructor. | |
| virtual | ~CObject () |
| Destructor. | |
| void | Kill () |
| Kill the object. | |
| bool | TooOld () |
| Kill me. | |
| void | GetRenderList (std::vector< Sage::CSpriteDesc3D > &) |
| Get render list. | |
| const Vector3 & | GetPos () const |
| Get position. | |
| const Vector3 & | GetVel () const |
| Get velocity. | |
| const float | GetRoll () const |
| Get roll angle. | |
| const eSprite | GetType () const |
| Get sprite type. | |
| void | SetRotSpeed (float) |
| Set roll speed. | |
| void | SetLifeTime (float) |
| Set lifetime. | |
Public Member Functions inherited from CCommon | |
| float | Wrap (float) |
| Wrap horizontal distance. | |
Private Member Functions | |
| void | EmitSmoke () |
| Emit smoke particle periodically. | |
Private Attributes | |
| float | m_fSmokeTimer = 0.0f |
| Last time smoke was emitted. | |
| float | m_fDamage = 0.0f |
| Damage taken, between 0.0f and 1.0f. | |
| Sage::CSoundDesc | m_sSoundDesc |
| Engine sound descriptor. | |
Additional Inherited Members | |
Protected Attributes inherited from CObject | |
| Sage::CSpriteDesc3D * | m_pSpriteDesc = nullptr |
| Pointer to sprite descriptor. | |
| Vector3 | m_vVel = Vector3::Zero |
| Velocity. | |
| float | m_fRollSpeed = 0.0f |
| Roll speed in revs per second. | |
| float | m_fFrameTimer = 0.0f |
| Last time the frame was changed. | |
| float | m_fFrameInterval = 0.1f |
| Interval between frames. | |
| float | m_fBirthTime = 0.0f |
| Time of creation. | |
| float | m_fLifeTime = FLT_MAX |
| Time that object lives. | |
| Sage::CParticleEngine3D * | m_pParticleEngine = nullptr |
| Pointer to a particle engine. | |
Static Protected Attributes inherited from CCommon | |
| static CRenderer * | m_pRenderer = nullptr |
| Pointer to the renderer. | |
| static CObjectManager * | m_pObjectManager = nullptr |
| Pointer to the object manager. | |
| static CPlaneObject * | m_pPlayer = nullptr |
| Pointer to player character. | |
| static float | m_fWorldScale = 2.0f |
| World scale. | |
| static Vector3 | m_vCellSize = Vector3::Zero |
| Cell size. | |
| static UINT | m_nNumCells = 3 |
| Number of cells. | |
| static float | m_fWorldWidth = 0.0f |
| World width. | |
| static eDrawMode | m_eDrawMode = eDrawMode::Playing |
| Draw mode. | |
| static eGameState | m_eGameState = eGameState::Loading |
| Game state. | |
The plane object is the player object.
| CPlaneObject::CPlaneObject | ( | const Vector3 & | p | ) |
| p | Initial position of plane. |
|
private |
Emit smoke particles proportional to the amount of damage that the plane has taken.

| void CPlaneObject::GetGunMuzzle | ( | Vector3 & | pos, |
| Vector3 & | direction ) const |
Get muzzle position in local space and its look-at vector. Offsets are hard-coded from the plane sprite.
| pos | [OUT] Gun muzzle position. |
| direction | [OUT] Gun muzzle direction. |

| void CPlaneObject::GunFireFx | ( | ) |
Assumes that m_vMuzzlePos has already been set to the gun muzzle's position.


|
virtual |
Move the plane, animate its particle engine, enforce upper and lower bounds on the plane's elevation and take damage if it hits the ground. Emit smoke if damaged. Move the audio listener point to the plane's current position.
Reimplemented from CObject.

|
virtual |
Writer function for the roll angle.
| angle | New roll angle. |
Reimplemented from CObject.


|
virtual |
Writer function for the plane's velocity. Ensure that its x comnponent doesn't get too big or too small, and adjust the engine sound's pitch proportional to speed.
| v | New velocity. |
Reimplemented from CObject.

