Any way to load sound effects? It would be awesome if we could load a small sound effect. For example when a player finds an item or something. Or when they’re being attacked.
If ChoiceScript is ported to HTML5, using sound files in a game would be relatively easy to implement.
Well, first of all, you can insert a code in the index.html file to constantly play a song on loop:
embed height=“50” width=“100” src=“insertsongnamehere.mp3”
That will make sort of a little media player box at the top of the screen if you put it under the header, and at the bottom if you put it after the “email us”. It might not play on all devices and browsers though.
You can also make it so it doesn’t show up at all, but it still plays the music. If you change the height and width to 1, there won’t be any option to stop/fast forward/rewind the music, so the players are forced to listen to it unless they mute their volume.
You can also use the HTML5 audio element by doing this:
source src=“insertsongnamehere.mp3” type=“audio/mpeg”
source src=“insertsongnamehere.ogg” type=“audio/ogg”
Your browser does not support this audio format.
Downside to this is that you have to convert the song in to different formats, and the audio element doesn’t work in older browsers.
@Pipebrain You don’t “port” stuff to HTML5 - HTML5 is a standard, and choicescript’s index.html is most certainly declared as an HTML5 compliant document.