Phaser.Component.Destroy = function (){ } ; Phaser.Component.Destroy.prototype = { destroyPhase: false , destroy: function (destroyChildren, destroyTexture){ if (this.game === null || this.destroyPhase) { return ; } if (destroyChildren === undefined) { destroyChildren = true ; } if (destroyTexture === undefined) { destroyTexture = false ; } this.destroyPhase = true ; if (this.events) { this.events.onDestroy$dispatch(this); } if (this.parent) { if (this.parent instanceof Phaser.Group) { this.parent.remove(this); } else { this.parent.removeChild(this); } } if (this.input) { this.input.destroy(); } if (this.animations) { this.animations.destroy(); } if (this.body) { this.body.destroy(); } if (this.events) { this.events.destroy(); } this.game.tweens.removeFrom(this); var i = _AN_Read_length('length', this.children); if (destroyChildren) { while (i-- ){ this.children[i].destroy(destroyChildren); } } else { while (i-- ){ this.removeChild(this.children[i]); } } if (this._crop) { this._crop = null ; } if (this._frame) { this._frame = null ; } if (Phaser.Video && this.key instanceof Phaser.Video) { this.key.onChangeSource.remove(this.resizeFrame, this); } if (Phaser.BitmapText && this._glyphs) { this._glyphs = [] ; } this.alive = false ; this.exists = false ; this.visible = false ; this.filters = null ; this.mask = null ; this.game = null ; this.data = { } ; this.renderable = false ; if (this.transformCallback) { this.transformCallback = null ; this.transformCallbackContext = null ; } this.hitArea = null ; this.parent = null ; this.stage = null ; this.worldTransform = null ; this.filterArea = null ; this._bounds = null ; this._currentBounds = null ; this._mask = null ; this._destroyCachedSprite(); if (destroyTexture) { this.texture.destroy(true ); } this.destroyPhase = false ; this.pendingDestroy = false ; } } ;