Hi there, I am making my own game and I'm using the tools you used to add audio into the game but I can't seem to get my audio to loop like you did. If you could explain how you did that, I would really appreciate it. Thanks!
Viewing post in UNDER A STAR CALLED SUN comments
hey GlitchedGod!
this tool is a slightly more complex version that allows you to use different audio files for different rooms and such, and you can toggle looping as well... https://kool.tools/bitsy/tools/bitsymuse-ui/
but if you're using just one track in your game, the add bitsy audio tool (https://kool.tools/bitsy/tools/add-bitsy-audio/) is still what i'd recommend and I'm pretty sure it does make the audio loop!
either way, getting a basic understanding how audio works in html might be even more helpful:
- https://www.w3schools.com/html/html5_audio.asp
- https://www.w3schools.com/TAGS/tag_audio.asp
in the second link there you'll see that you can add attributes to a html tag including "loop" or "autoplay" etc.
in my code for Under a Star Called Sun here's how both those tags are implemented in the <body>:
<body onload='startExportedGame()'> <body onload='startExportedGame()'> <audio loop="loop" autoplay="autoplay"> <source src="music.wav"> </audio> <!-- GAME CANVAS --> <canvas id='game'></canvas> </body>i guess what you can do is make sure the loop attribute is in your <audio> tag? it's hard to know where the problem comes from without seeing your code so this is the extent of how i can help for now.