How do I add a PIXI container into a Phaser Game?

I have a game made ONLY with PIXI. but now i would like to port it to a Phaser.

All my game content happens inside a pixi container "screenContainer". I tried to add a pixi container like this.

var created = function() {
       screenContainer = new PIXI.DisplayObjectContainer();
       var sprite = m.game.add.existing(screenContainer);

var.game = new Phaser.Game(gameWidth, gameHeight, Phaser.AUTO, "divId", { create: created }); 

but it stops here

"phaser.js" line 33067 
* The core update - as called by World.
* @method Phaser.Group#update
* @protected
Phaser.Group.prototype.update = function () {
var i = this.children.length;

while (i--)
    this.children[i].update(); // UPDATE IS UNDEFINED


because Pixi.Container, does not have "update" method.

Is there any other way to add a pixi container inside a phaser game?


1 Answer 1


All Phaser display objects (group, sprites...) are based on PIXI ones. PIXI objects can be rendered in phaser render tree. the only problem is the update and postUpdate function.

I solved it adding this simple patch:

PIXI.DisplayObject.prototype.update = function () { };
PIXI.DisplayObject.prototype.postUpdate = function () { };

this patch adds a empty function for "update" and "postUpdate" methods in PIXI displayObjects prototype. In that case Phaser update tree founds a function to execute.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .