Jump to content

difference of physicsBodyType = Phaser.Physics.ARCADE AND game.physics.arcade.enable(platforms); AND


Recommended Posts

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.enable(object, Phaser.Physics.ARCADE);


Are they really the same?

Link to comment
Share on other sites

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       .enable(groupOrSprite, Phaser.Physics.ARCADE);
physics       .enable(groupOrSprite, /* default: ARCADE */);


Link to comment
Share on other sites


  • Recently Browsing   0 members

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