Merge pull request #6569 from Trissolo/refineGameObjectSetTexture

Added two optional parameters to GameObjects.Components.Texture#setTexture
This commit is contained in:
Richard Davey 2023-08-28 15:39:47 +01:00 committed by GitHub
commit 5846acf682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,14 +56,16 @@ var Texture = {
*
* @param {(string|Phaser.Textures.Texture)} key - The key of the texture to be used, as stored in the Texture Manager, or a Texture instance.
* @param {(string|number)} [frame] - The name or index of the frame within the Texture.
* @param {boolean} [updateSize=true] - Should this call adjust the size of the Game Object?
* @param {boolean} [updateOrigin=true] - Should this call change the origin of the Game Object?
*
* @return {this} This Game Object instance.
*/
setTexture: function (key, frame)
setTexture: function (key, frame, updateSize, updateOrigin)
{
this.texture = this.scene.sys.textures.get(key);
return this.setFrame(frame);
return this.setFrame(frame, updateSize, updateOrigin);
},
/**