Yea um, so… I added sound to YUI Tetris
Thanks to Scott Schiller and his dandy Sound Manager (from ages ago) which allows you to embed audio into your webpage and fire them at will with JavaScript. Sounded simple enough so I dropped in the soundmanager.js file, a .swf, and then an xml file to define my sounds… then Voila! it was a piece of cake. It was as easy as dropping in the appropriate triggers in particular points of my tetris script such as moveLeft, moveRight, drop, nukeLines or rotate. I experienced first hand the benefits of writing in Object Notation when I had to go back and do some editing…
So really, you added sound!!??
Before I get hosh posh from the purist who will have liked it better without the cheesy sound effects, I just want to let everyone know… I was just having fun. And for those who barked and moaned the first time about my choice of keys to use for controlling the blocks; I had a perfectly good explanation of those, and that is that it is a mirror of the original Nintendo layout. Left hand on the directional pad (s | d | f). And your right hand on the A & B buttons (for rotating (and yes, you can rotate both directions in the original tetris!!)). In all seriousness, please don’t continue to comment on the keys. It’s literally a matter of changing like 3 lines of code.
One final sidenote
This is NOT Ajax. Sorry to disappoint. It’s a video game with animation and sounds. There is not a single instance of xmlHttpRequest in all of the code.
Now enjoy the mario bros music while playing tetris ;)













May 25th, 2006 at 5:45 am
You should have written it in prev post in font-size: 10em… digg kids yelled “ajax, ajax” further than you think. :/ :(
May 25th, 2006 at 9:40 am
So true. It’s funny that whenever something moves or is interactive in Javascript, people automatically assume it’s AJAX.
May 28th, 2006 at 3:55 am
How about adding this audio stuff to new Yahoo! Mail Beta? For ex. when a new mail comes it would be good to be notified by a sound.
August 11th, 2006 at 1:32 am
AJAX is communicating of a browser and a server through javascript without refreshing or changing the page. It’s clear that there is no need of AJAX here.
I think it’s better to put the sounds in a swf, then javascript will command the flash player to play the correct sound. you might have done this way but i didn’t checked yet.
December 4th, 2006 at 7:13 am
At first I thought it is Ajax too. Nevertheless, Javascript and Ajax are sometimes looking very similar :-) By the Way, I love the Mario Bros Music, it reminds me on the 90s.
March 18th, 2007 at 3:29 am
I dont understand much about Ajax or Javascript, but the game ist really cool and the sound fits perfectly.