physicsGroup(physicsBodyType, parent, name, addToStage) → {Phaser.Group}
A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
A Physics Group is the same as an ordinary Group except that is has enableBody turned on by default, so any Sprites it creates
are automatically given a physics body.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
physicsBodyType | number | <optional> | Phaser.Physics.ARCADE | If enableBody is true this is the type of physics body that is created on new Sprites. Phaser.Physics.ARCADE, Phaser.Physics.P2JS, Phaser.Physics.NINJA, etc. |
parent | any | <optional> | The parent Group or DisplayObjectContainer that will hold this group, if any. If set to null the Group won't be added to the display list. If undefined it will be added to World by default. | |
name | string | <optional> | 'group' | A name for this Group. Not used internally but useful for debugging. |
addToStage | boolean | <optional> | false | If set to true this Group will be added directly to the Game.Stage instead of Game.World. |
Returns
The newly created Group.
- Source code: gameobjects/GameObjectFactory.js (Line 190)
Please login to continue.