Group#Group

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.
If undefined/unspecified the Group will be added to the Game World; if null the Group will not be added to any parent.

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)
doc_phaser
2017-02-14 10:51:22
Comments
Leave a Comment

Please login to continue.