new Group(game, parent, name, addToStage, enableBody, physicsBodyType)
A Group is a container for display objects including Sprites and Images.
Groups form the logical tree structure of the display/scene graph where local transformations are applied to children.
For instance, all children are also moved/rotated/scaled when the group is moved/rotated/scaled.
In addition, Groups provides support for fast pooling and object recycling.
Groups are also display objects and can be nested as children within other Groups.
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
game | Phaser.Game | A reference to the currently running game. | ||
parent | DisplayObject | null | <optional> | (game world) | The parent Group (or other DisplayObject) that this group will be added to. |
name | string | <optional> | 'group' | A name for this group. Not used internally but useful for debugging. |
addToStage | boolean | <optional> | false | If true this group will be added directly to the Game.Stage instead of Game.World. |
enableBody | boolean | <optional> | false | If true all Sprites created with #create or #createMulitple will have a physics body created on them. Change the body type with #physicsBodyType. |
physicsBodyType | integer | <optional> | 0 | The physics body type to use when physics bodies are automatically added. See #physicsBodyType for values. |
- Source code: core/Group.js (Line 27)
Please login to continue.