OptionalatPlace this sound at a fixed world point. Same coordinates and same
defaults as follow, for something that does not move.
Mutually exclusive with follow: passing both throws, rather than
quietly picking one and leaving the other looking broken.
OptionalfollowPlace this sound at a renderable and keep it there, re-reading its world position every frame. Tracking stops when the renderable is destroyed.
Positions are WORLD pixels, with +y down like everything else in
melonJS; the Y flip Web Audio wants is applied for you. Sounds placed
this way are given the pixel-shaped panner defaults, which
audio.setSpatialDefaults() can change and audio.panner() overrides.
The sound sits at the renderable's getAbsolutePosition(), which is
where its anchorPoint sits: its center under the (0.5, 0.5) default
of a Renderable or a Sprite, but its TOP-LEFT corner under the
(0, 0) of an Entity or of any object loaded from Tiled. For a large
entity, such as a boss, that puts the sound half its size up and to the
left of where it looks to be.
OptionalloopLoop playback when the region ends. Defaults to the region's own loop
flag (the third element of its sprite entry), else false.
OptionalonendCalled when this instance finishes playing.
OptionalspriteName of a region declared in the clip's sprite map. Omit to play the
whole clip.
OptionalstopStop the sound when the renderable it follows is destroyed, rather than
leaving it playing where the renderable was. Defaults to false.
Note that stopping discards the playback id, so keep this false for a
looping sound you intend to reposition and resume later.
OptionalvolumePlayback volume, 0.0..1.0. Defaults to the current global volume.
Options accepted by
audio.playin place of the positionalloopargument.Every field is optional, and the positional form
play(name, loop, onend, volume)continues to work unchanged.