Re: Modules to help build Audio Games in the browser

How I made js audio games back in the days of IE6:

Usually, the script for the game was in the html file, so as to have easy access to named elements. I offloaded the "getElementByX" crap to functions as much as possible.
I kept an ever-expanding script file with seemingly useful stuff. Somehow, I mostly only used my workaround for the array length issue (it seems like that's been solved since?), cookies, changing the contents of divs, and moving images.
So an example might look like:

<html>
<head>
<title>Demo Game</title>
<script src="" type="text/_javascript_">
<!— sound was only really available through embed objects: —>
<embed name="mysound" src="" autostart=false hidden=true loop=false mastersound>
</head>
<body _onkeydown_="keyPressed(window.event.keyCode)" _onkeyup_="keyReleased(window.event.keyCodegg">
<div id="textlayer">Press any key to begin?</div>
<script language="_javascript_" type="text/_javascript_">
<!— Hide the script from ancient browsers...
function keyPressed (k) {
if (!k) k=window.event.keyCode;
if (k==65) document.mysound.play();
else if (k==90) WriteLayer("textlayer", "You pressed z, right?");
}

function keyReleased(k) {
if (!k) k=window.event.keyCode;
if (k==65) WriteLayer("textlayer", "Wasn't that fun?");
else if (k==87) document.mysound.stop();
}
// end hide —>
</script></body></html>

I might have made some mistake in there, but that's the idea I understand that window.event is deprecated and all the many tutorials telling me to use it should have gone with, like, document.event or something instead. Also, people have decided to drop the hiding, since the internet is gated now or something and who uses Netscape anymore, anyway? And apparently audio is ... is audio easier now? Because I had balance, volume, and rate available through embeds, so 2d sound was trivial. I understand we have 3D now (for whatever that's worth in a world without 3d audiogames), and that <embed> has to preload everything and that takes forever and clashes with post-IE6 security things. But how you do audio seems to be different every year and requires all of this additional setup, and I am lost and slow to trust anymore.
Oh, and I left out timeouts. For some reason the setTimeout function always made me nervous, not that I didn't use it.

So, my main question: after doing everything in the OP, installing this that and the other, typing 5 CLI commands, and setting up one of those hidious standardized project directory trees, how complicated are handling events, playing sound, and dealing with HTML elements? Will it work? Because if I follow the steps as given and cannot get these things to happen with comparable ease after 3 tries, I give up entirely and resign myself to being the annoying old person whose response to everything is "back in my favorite decade..."

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : GhorthalonTheDragon via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : sanslash332 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Orin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : GhorthalonTheDragon via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Orin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Kyleman123 via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Orin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : GhorthalonTheDragon via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Orin via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : kaigoku via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : GhorthalonTheDragon via Audiogames-reflector

Reply via email to