kriket Posted September 21, 2015 Share Posted September 21, 2015 I am making platforms and assigning them to a group. create: function() { this.playerCollisionGroup = this.game.physics.p2.createCollisionGroup(); this.stationaryCollisionGroup = this.game.physics.p2.createCollisionGroup(); // PLATFORMS this.stationary = this.game.add.group(); this.stationary.enableBody = true; this.stationary.createMultiple(125, 'climb'); this.stationary.physicsBodyType = Phaser.Physics.P2JS; for(var i = 0; i < this.stationary.children.length; i++){ this.stationary.children[i].body.setCollisionGroup(this.stationaryCollisionGroup); this.stationary.children[i].body.collides(this.playerCollisionGroup); }}But this gives me the error:Uncaught TypeError: this.stationary.children[i].body.setCollisionGroup is not a function I thought this would work. Can anyone help me find out why this is not working? Link to comment Share on other sites More sharing options...
rich Posted September 21, 2015 Share Posted September 21, 2015 You should set the physicsBodyType before calling createMultiple, otherwise they'll get an arcade Physics body instead. kriket 1 Link to comment Share on other sites More sharing options...
Recommended Posts