Phaser API Documentation

  Version: 
setListenerPosition([x], [y])

Description:

Sets the X and Y position of the Spatial Audio listener on this Web Audios context.

If you call this method with no parameters it will default to the center-point of the game canvas. Depending on the type of game you're making, you may need to call this method constantly to reset the listener position as the camera scrolls.

Calling this method does nothing on HTML5Audio.

Parameters:

name type arguments description
x number <optional>

The x position of the Spatial Audio listener.

y number <optional>

The y position of the Spatial Audio listener.

Since: 3.60.0