SpriteBatch#resetChild()

resetChild(child, x, y, key, frame) → {DisplayObject}

Takes a child and if the x and y arguments are given it calls child.reset(x, y) on it.

If the key and optionally the frame arguments are given, it calls child.loadTexture(key, frame) on it.

The two operations are separate. For example if you just wish to load a new texture then pass null as the x and y values.

Parameters
Name Type Argument Description
child DisplayObject

The child to reset and/or load the texture on.

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 child that was reset: usually a Phaser.Sprite.

Inherited From
Source code: core/Group.js (Line 2165)
doc_phaser
2017-02-14 11:12:23
Comments
Leave a Comment

Please login to continue.