Skip to content
Brandon Dyer edited this page Dec 21, 2018 · 1 revision

Components hold the data that describes each entity. It is often used as a label to show possession of a given trait. Examples: position, velocity, rotation, mesh, transparency, mass, size, etc.

C++

Implement

entity.AddComponent(new PositionComponent(x, y));

Create

class PositionComponent : public Component {
public:
  // Data
  Vec3 position;
  // Constructor
  PositionComponent(Vec3 position) : position(position){};
};

Lua

Implement

entity.AddComponent(PositionComponent:New(x, y))
Clone this wiki locally