Skip to content
Joaquin Bello edited this page Dec 8, 2019 · 1 revision

Entities are objects that can be updated each frame and can be parent of other entities. If an entity wants to be active it needs to be added to an active state(state is also a entity), or be the child of an entity that is active. To do this we use the function addChild(entity). When we want to remove an entity we have to call the function die() this will mark the entity to be removed in the next parent's update. Entities can be pools of entities too by setting the attribute pool to true. We can then recycle entities instead of allocating new memory.

By overriding the function update(dt:Float) we can make ower entity do stuff each frame, be sure to call super.update(dt) or the entities children won't be updated.

Entities don't have a graphics or collision, we have to add them as attributes this allows us to have more customizable entities.

Clone this wiki locally