Vignarg Posted October 19, 2015 Share Posted October 19, 2015 I'm going through Interphase and trying to replicate that pool game. The guide says by simply enabling P2 on a sprite, it sets the anchor on the body to .5, but when I compile, the sprite is still halfway off the screen. More, when I uncomment the "body.static = true" portion, I get a console error that there is no body. I checked the other Phaser examples on p2 basics, and everything seems right. The system is started, the sprite is enabled for it, but these symptoms clearly seem to indicate there's no physics system going on. Any ideas? module EightBall { export class MainGame extends Phaser.Game { constructor(){ super(800, 600, Phaser.CANVAS, 'game', null, false, true) this.state.add('preloader', Preloader, false); this.state.add('mainMenu', MainMenu, false); this.state.add('play', Play, false); this.state.start('preloader'); } } export class Preloader extends Phaser.State { init() { this.scale.pageAlignHorizontally = true; this.physics.startSystem(Phaser.Physics.P2JS); } preload() { this.load.path = 'Assets/'; this.load.images(['table']); this.load.physics('table'); } create() { this.game.state.start('mainMenu'); } } export class MainMenu extends Phaser.State { create() { this.game.state.start('play'); } } export class Play extends Phaser.State { table: Phaser.Sprite; create() { this.table = this.add.sprite(400, 300, 'table'); this.physics.p2.enable('table'); // this.table.body.static = true; } } }window.onload = () => { var game = new EightBall.MainGame();} Link to comment Share on other sites More sharing options...
Vignarg Posted October 19, 2015 Author Share Posted October 19, 2015 Nevermind, I saw it as soon as I posted, but right after I lost wifi on the train lol. this.physics.enable(this.table);not this.physics.enable('table');I need to get a rubberduck. in mono 1 Link to comment Share on other sites More sharing options...
Recommended Posts