![]() |
Top-down Shooter With Sprite Sheets
A Top-Down Shooter With Sprite Sheets and Sprite Animation
|
The ant object. More...
#include <Ant.h>
Public Member Functions | |
CAnt (const Vector2 &) | |
Constructor. More... | |
~CAnt () | |
Destructor. | |
virtual void | move () |
Move ant. 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... | |
void | StrayFromPath () |
Stray randomly from path. More... | |
void | UpdateFramenumber () |
Update frame number. More... | |
![]() | |
virtual void | DeathFX () |
Death special effects. More... | |
const Vector2 | GetViewVector () const |
Compute view vector. More... | |
Protected Attributes | |
LEventTimer * | m_pFrameEvent = nullptr |
Frame event timer. | |
LEventTimer * | m_pStrayEvent = nullptr |
Stray event timer. | |
bool | m_bStrayParity = true |
Stray from path left or right. | |
bool | m_bPreferPosRot = true |
Prefer positive rotation. | |
![]() | |
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 is a friend. | |
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 Vector2 | m_vWorldSize = Vector2::Zero |
World height and width. | |
static CPlayer * | m_pPlayer = nullptr |
Pointer to player character. | |
CAnt is the abstract representation of an ant object.
CAnt::CAnt | ( | const Vector2 & | pos | ) |
Create and initialize an ant object given its initial position.
pos | Initial position of ant. |
|
protectedvirtual |
Response to collision. If the ant is facing the object that is colliding with, then it rotates in its preferred direction and then calls CObject::CollisionResponse. Note that the only reason that colliding ants won't be facing each other is in the case of multiple ants colliding and pushing one of them in some direction other than the one in which it is facing. Howerver, faster objects such as the player objact can collide from behind.
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 |
Move and advance current frame number. Also stray randomly from current path.
|
protected |
Adjust direction randomly at random intervals.
|
protected |
Update the frame number in the animation sequence.