From 1ea1c9313c4ff9f53ba41ca1b8503933340938b6 Mon Sep 17 00:00:00 2001 From: Trissolo <00tristano00@gmail.com> Date: Wed, 2 Aug 2023 11:17:20 +0200 Subject: [PATCH] Added two optional parameters, 'updateSize' and 'updateOrigin', which are used as second and third arguments when setting the frame. In fact 'setFrame()' takes three arguments --- src/gameobjects/components/Texture.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gameobjects/components/Texture.js b/src/gameobjects/components/Texture.js index 7e746603e..343e5f870 100644 --- a/src/gameobjects/components/Texture.js +++ b/src/gameobjects/components/Texture.js @@ -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); }, /**