Jump to content

game.add.existing crashes


MattS
 Share

Recommended Posts

Since Phaser 2, sprites body is null until you activate them into any Physics system.

 

That's probably the cause of your error.

 

Since I guess that tutorial is written for 1.1.x, it will use Arcade Physics. Try this:

game.physics.enable(this);game.add.existing(this);

Anyway, Phaser changed a lot in version 2, so you could either download 1.1.6 and do the tutorial with it, or just stick to 2 and probably deal with some more errors like this, looking into version changes and docs.

Link to comment
Share on other sites

It doesn't make sense because transitioning other code from 1.1.x to 2.0 worked. 

 

For example: 

this.stage.scaleMode = Phaser.StageScaleMode.SHOW_ALL;this.stage.scale.minWidth = 480;this.stage.scale.minHeight = 260;this.stage.scale.maxWidth = 1024;this.stage.scale.maxHeight = 768;this.stage.scale.forceLandscape = true;this.stage.scale.pageAlignHorizontally = true;this.stage.scale.setScreenSize(true);

now works fine as:

this.game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;this.game.scale.minWidth = 480;this.game.scale.minHeight = 260;this.game.scale.maxWidth = 1024;this.game.scale.maxHeight = 768;this.game.scale.forceLandscape = true;this.game.scale.pageAlignHorizontally = true;this.game.scale.setScreenSize(true);

So why doesn't game.physics.enable work, or even exist for that matter? 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...