Class: Destroy

Phaser.Component. Destroy

new Destroy()

The Destroy component is responsible for destroying a Game Object.

src/gameobjects/components/Destroy.js line 12


<readonly> destroyPhase : boolean

As a Game Object runs through its destroy method this flag is set to true, and can be checked in any sub-systems or plugins it is being destroyed from.

  • boolean
src/gameobjects/components/Destroy.js line 22


destroy( [destroyChildren] [, destroyTexture])

Destroys the Game Object. This removes it from its parent group, destroys the input, event and animation handlers if present and nulls its reference to game, freeing it up for garbage collection.

If this Game Object has the Events component it will also dispatch the onDestroy event.

You can optionally also destroy the BaseTexture this Game Object is using. Be careful if you've more than one Game Object sharing the same BaseTexture.

Name Type Argument Default Description
destroyChildren boolean <optional>

Should every child of this object have its destroy method called as well?

destroyTexture boolean <optional>

Destroy the BaseTexture this Game Object is using? Note that if another Game Object is sharing the same BaseTexture it will invalidate it.

src/gameobjects/components/Destroy.js line 37

phaser-ce@2.8.8 is on GitHub and NPM

Documentation generated by JSDoc 3.5.4 on 2017-09-25 using Tomorrow.