Rubeus::RGameObject class

A game object. Main class responsible for player interactions.

Base classes

class RMasterComponent
A master component. Serves as parent class for all components.

Public static variables

static std::unordered_map<std::string, RGameObject*> InstantiatedGameObjects
The singular array that tracks all objects that were instantiated of this class.

Constructors, destructors, conversion operators

~RGameObject()
Destructor.
RGameObject() protected
Protected constructor. Only used to create groups.

Public functions

void begin() virtual
Called by the engine once before the level starts to run.
void tick() override
Tick function.
void onHit(RGameObject* hammer, RGameObject* nail, const Awerere::ACollideData& collisionData) virtual
User defined function called whenever a hit event is generated.
void enableTick()
Set this object for tick by update function.
auto add(RGameObject* gameObject) -> RGameObject&
Adds a game object as the child of this object.
void gameobject_ok(var data = NULL)
Checks the state of game object.

Public variables

std::string m_Name
Name of this game object.
RLevel* m_ParentLevel
The level context during which this object lives.
GraphicComponents::RSprite* m_Sprite
Sprite used for the rendering process.
Awerere::APhysicsObject* m_PhysicsObject
Physics object that handles collisions/response.
RML::Matrix4 m_TransformationMatrix
The transform used to place the children of this game object.
std::vector<RGameObject*> m_Children
Vector array of child objects.
bool m_ThisTicks
Whether this gameobject ticks.
bool m_UsesTexture
Whether this gameobject uses a texture.
bool m_IsGroup
Whether this gameobject is a group of other child gameobjects.
bool m_HasPhysics
Whether this gameobject obeys physics and responds to collisions.
bool m_GeneratesHit
Whether this gameobject generates hit events.

Function documentation

void Rubeus::RGameObject::tick() override

Tick function.

void Rubeus::RGameObject::onHit(RGameObject* hammer, RGameObject* nail, const Awerere::ACollideData& collisionData) virtual

User defined function called whenever a hit event is generated.

Parameters
hammer The hitting object.
nail The object getting hit
collisionData Details of the collision

RGameObject& Rubeus::RGameObject::add(RGameObject* gameObject)

Adds a game object as the child of this object.

Parameters
gameObject The game object to be added to this group.
Returns Reference to this group object. Allows chaining add() calls. E.g. object.add(r1).add(r2);

void Rubeus::RGameObject::gameobject_ok(var data = NULL)

Checks the state of game object.

Parameters
data NULL