Although there is a lot more to do to make the Asteroids game complete there is something very important missing that I thought needed adding next. Sound. Even adding the pwep! sound of a shot being fired would make the whole thing seem more complete.
To this end I thought I would take a look at the audio tag. Then it all just started going downhill. It seems each browser has implemented it differently. I had some success getting FireFox and Safari to play a wav file. Opera remained silent regardless of what sound file I gave it. I haven’t had a chance to try Chrome but from what I have read it does not support wav files but can play ogg ( which firefox supports but safari does not). Oh what a pickle. I thought/hoped the standard would specify what formats should be supported and all the browsers would implement it. Instead it seems it only specifies the methods/attributes. As an additional blow the methods available seem a little incomplete. From what I can see ( correct me if I’m wrong ) you can play and pause and carry on playing but you cannot stop and start playing from the beginning again. As I said.. what a pickle. This is going to take longer than I thought. It also explains why so many Html5 demo’s do not play sound or only play sound on specific browsers. BAH!