Entities
An Entity in is an empty container for Components which store data, alone an Entity has little behavior.
They are useful for defining bare bones game objects with custom behavior.
If you want a batteries included prebuilt Entity use an Actor, read more here. Remember an Excalibur Actor is just an Entity with a list of prebuilt components and some useful apis built over them.
Entity
Entities have no behavior by default, only a few lifecycle hooks onInitialize
, and a concept of parent/children.
Building and adding an entity to a game is pretty straightforward.
typescript
const game = new ex.Engine({...});const entity = new ex.Entity();const entityWithName = new ex.Entity({name: 'Named Entity'});game.currentScene.add(entity);
typescript
const game = new ex.Engine({...});const entity = new ex.Entity();const entityWithName = new ex.Entity({name: 'Named Entity'});game.currentScene.add(entity);