Physics.P2.BodyDebug#create()

create(x, y, key, frame, exists, index) → {DisplayObject}

Creates a new Phaser.Sprite object and adds it to the top of this group.

Use classType to change the type of object created.

The child is automatically added to the top of the group, and is displayed above every previous child.

Or if the optional index is specified, the child is added at the location specified by the index value,
this allows you to control child ordering.

If Group.enableBody is set, then a physics body will be created on the object, so long as one does not already exist.

If Group.inputEnableChildren is set, then an Input Handler will be created on the object, so long as one does not already exist.

Parameters
Name Type Argument Default Description
x number

The x coordinate to display the newly created Sprite at. The value is in relation to the group.x point.

y number

The y coordinate to display the newly created Sprite at. The value is in relation to the group.y point.

key string | Phaser.RenderTexture | Phaser.BitmapData | Phaser.Video | PIXI.Texture <optional>

This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache Image entry, or an instance of a RenderTexture, BitmapData, Video or PIXI.Texture.

frame string | number <optional>

If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

exists boolean <optional>
true

The default exists state of the Sprite.

index integer <optional>

The index within the group to insert the child to. Where 0 is the bottom of the Group.

Returns

The child that was created: will be a Phaser.Sprite unless #classType has been changed.

Inherited From
Source code: core/Group.js (Line 544)
doc_phaser
2017-02-14 11:03:05
Comments
Leave a Comment

Please login to continue.