Overlapping audio files?

Couldn’t find much on this, pretty simple question. I want to play a sound when user presses a key, but i want the sound to overlap itself if pressed multiple times. How do i do this? Right now, I have it so that when u press the key while the sound is playing, the sound just restarts. (i.e sound stops playing, then starts from the beginning)

Overlapping SoundFX get cut off. · Issue #1220 · photonstorm/phaser · GitHub I found this thread covering the same thing but I believe its outdated, the sound.allowMultiple flag mentioned there does not seem to be working for me? I’m still a novice so I could just be doing it wrong, would love to know.

Heres basically an example of what I have right now (preload and input is settled already)

sound=this.sound.add(‘sound1’,{volume: 0.4})
//tap W for sound
keyW.on(‘down’, function(event) {
sound.play();
})

any help appreciated

:wave:

The simplest way to do this is to change to

this.sound.play('sound1', { volume: 0.4 });

hi thanks for the solution! this does indeed work for making the sounds overlap! because it was in the key.on() function i had to change it to gameScene.sound.play, but it worked! Thanks!