Phaser API Documentation

  Version: 
setSortCallback([callback])

Description:

Sets a callback to be used to sort the particles before rendering each frame.

This allows you to define your own logic and behavior in the callback.

The callback will be sent two parameters: the two Particles being compared, and must adhere to the criteria of the compareFn in Array.sort:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#description

Call this method with no parameters to reset the sort callback.

Setting your own callback will override both the particleBringToTop and sortProperty settings of this Emitter.

Parameters:

name type arguments description
callback Phaser.Types.GameObjects.Particles.ParticleSortCallback <optional>

The callback to invoke when the particles are sorted. Leave undefined to reset to the default.

Returns:
Description:

This Particle Emitter.

Since: 3.60.0