Specifically, can you load up an audio file in index.html. And then create JavaScript *functions in mygame.js that reference to that audio file (pause, play) that when inputed into your scene files as a command (or just the raw function) will play the audio you loaded up in index.html when you type in the “play” command/function automatically and vice versa?
@Malebranche
I am sure if you have the skill you could add it to mygame.js, but they do not encourage such discussions here. More then likely it would not be supported by CoG. I know you can add it to the index. Would have to do a search here on the board on how to do so.
@Lordirish, that link is useful to add music to your game, the way Blackraven (WIP) and Trial of the Demon Hunter (HG) have. However, it doesn’t explain how to add music cues to start or end the music at a given scene. I guess it would involve creating a new choicescript command, of which I have no idea how to do…
Oh, I don’t know about genius and all that, after all, P0RT3R was the one who mentioned the *script command in the first place (in HornHeadFan’s Game soundtrack thread), and I just ad-libbed the java script from a W3schools html example.
I might be the odd one out here, but I’d caution you guys to think very carefully before you put music or sound into your games. The main virtue of this kind of game is that it is lightweight and has low requirements. Music will jack up the file size immensely, and I’m probably not alone in playing games muted anyway. Sam’ll hate me, but I feel the same way about pictures. I’d prefer text only, none of this extra stuff.
To each their own, but I think it’ll add to the story in my opinion. A chorus of string instruments playing sharp and drawn out notes could really amp up the setting a haunted crypt would give off or old jazz would of worked perfectly in games like Life of a Mobster in a speakeasy scene
@TumTum
Even though it does increase the file size, you don’t have to otherwise acknowledge the music or illustrations. The music starts off paused, and you can skip over the images. Many others, including me, though, think they add flavor.
Yes, you can do it that way or even make proper commands by extending the Scene object (via prototype) and adding it to the valid commands object.
You can do anything you can usually do with HTML/JS/CSS, the real question is whether or not COG will publish it. But please, if you’re going to this don’t use a separate function and command for every track, look up some JS tutorials and use function parameters.