Beyb26 Posted July 3, 2017 Share Posted July 3, 2017 Hello. I'm really confused about this, what is really the difference of these 3 enabling method of physics body in Phaser? object.physicsBodyType = Phaser.Physics.ARCADE; game.physics.arcade.enable(object); game.physics.enable(object, Phaser.Physics.ARCADE); Are they really the same? Link to comment Share on other sites More sharing options...
samme Posted July 3, 2017 Share Posted July 3, 2017 You need to remember the difference between a Group and a Sprite. // Group#enableBody: When a sprite is added to this group, give it a physics body. group.enableBody = true; // Group#physicsBodyType: When `enableBody` is on, add bodies of this type. group.physicsBodyType = Phaser.Physics.ARCADE; // (default) // Add a physics body to a sprite or all the sprites in a group. // All forms are equivalent, so use whichever you prefer. physics.arcade.enable(groupOrSprite); physics .enable(groupOrSprite, Phaser.Physics.ARCADE); physics .enable(groupOrSprite, /* default: ARCADE */); Link to comment Share on other sites More sharing options...
Beyb26 Posted July 4, 2017 Author Share Posted July 4, 2017 Thanks Sir. Link to comment Share on other sites More sharing options...
Recommended Posts