Physics.P2.BodyDebug#getFirstExists()

getFirstExists(exists, createIfNull, x, y, key, frame) → {DisplayObject}

Get the first display object that exists, or doesn't exist.

You can use the optional argument createIfNull to create a new Game Object if none matching your exists argument were found in this Group.

It works by calling Group.create passing it the parameters given to this method, and returning the new child.

If a child was found , createIfNull is false and you provided the additional arguments then the child
will be reset and/or have a new texture loaded on it. This is handled by Group.resetChild.

Parameters
Name Type Argument Default Description
exists boolean <optional>
true

If true, find the first existing child; otherwise find the first non-existing child.

createIfNull boolean <optional>
false

If true and no alive children are found a new one is created.

x number <optional>

The x coordinate to reset the child to. The value is in relation to the group.x point.

y number <optional>

The y coordinate to reset the child to. 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.

Returns

The first child, or null if none found and createIfNull was false.

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

Please login to continue.