diff --git a/src/textures/Texture.js b/src/textures/Texture.js index 6c4e21aa4..e63b349d6 100644 --- a/src/textures/Texture.js +++ b/src/textures/Texture.js @@ -177,6 +177,35 @@ var Texture = new Class({ return frame; }, + /** + * Removes the given Frame from this Texture. The Frame is destroyed immediately. + * + * Any Game Objects using this Frame should stop using it _before_ you remove it, + * as it does not happen automatically. + * + * @method Phaser.Textures.Texture#remove + * @since 3.19.0 + * + * @param {string} name - The key of the Frame to remove. + * + * @return {boolean} True if a Frame with the matching key was removed from this Texture. + */ + remove: function (name) + { + if (this.has(name)) + { + var frame = this.get(name); + + frame.destroy(); + + delete this.frames[name]; + + return true; + } + + return false; + }, + /** * Checks to see if a Frame matching the given key exists within this Texture. *