I am making a game with the kaboom library and would like to add background music, i read the docs and found const music = play("music"); music.loop() but this seems to only play it once, the file is an MP3 file and i dont get any errors
Asked
Active
Viewed 143 times
2 Answers
0
You can use something like:
const music = play("music", {loop: true});
to loop your music.
Captain Cookie 15
- 31
- 3
0
You can write as following to loop:
loadSound("music", "path/to/music.mp3").then((music) =>{
music.play({loop:true});
});
Farkhod Abdukodirov
- 877
- 7
- 24