Convert a PIXI.Container to an entity with logic support. This is the main way to add Moxi functionality to PIXI objects.
Any PIXI.Container (Sprite, Graphics, Container, etc.)
Optional initial logic components to attach
The same entity with moxiEntity property attached
const player = asEntity(new PIXI.Sprite(texture));player.moxiEntity.addLogic(new PlayerController());scene.addChild(player);// With initial logicconst enemy = asEntity(new PIXI.Sprite(texture), { 'EnemyAI': new EnemyAI()}); Copy
const player = asEntity(new PIXI.Sprite(texture));player.moxiEntity.addLogic(new PlayerController());scene.addChild(player);// With initial logicconst enemy = asEntity(new PIXI.Sprite(texture), { 'EnemyAI': new EnemyAI()});
Convert a PIXI.Container to an entity with logic support. This is the main way to add Moxi functionality to PIXI objects.