Archive for July, 2011

Safari not liking the HTML5 Audio

Posted in All, Programing, Web Development on July 30th, 2011 by Jarred – 1 Comment

 Well this one threw me for a loop….

 I never use Safari, but in an attempt to make my latest HTML5 Game compatible in all the major browsers I downloaded the PC version of Safari to do some testing and trouble shooting to see if it would work. The game worked well in Chrome, Firefox, and I.E. so I assumed it would just work in Safari. But no, to my surprise it started throwing the following error every time I tried playing one of the audio elements.

 TypeError: ‘undefined’ is not a function (evaluating ‘audioElement.play()’)

 After much frustration I came across a post which indicated that HTML5 audio and video tags will not work in Safari without QuickTime. So much for HTML5 not requiring any plug-ins. I installed QuickTime and to my dismay Safari was now giving me the following error when I tried to start it up.

This application has failed to start because QTCF.dll was not found. Re-installing the application may fix this problem.

After trying to reinstall the the browser (this did not work) I found the QTCF.dll file in the Program Files/QuickTime/QTsystem made a copy of it and put it in Windows/System32. This solve the problem and Safari now started up. I was able to load my game with no more errors playing the audio objects. Safari seemed to handle the canvas object fairly well (although the frame rate on seems to be fairly poor).

Source: http://happyworm.com

Source: http://answers.yahoo.com/question/index?qid=20090912133753AAM60Ur

Free Animated explosion on transparent background

Posted in Geekdom, Programing on July 5th, 2011 by Jarred – 1 Comment

While creating my first game I came across the need for some sprite sized explosion animations. I tried multiple times to draw them myself, however I just couldn’t get them to look right. So I turned to the web to see if I could find some royalty free explosion animations that I could use in my game. After a little searching I found several suitable sprite sheets like the one below on http://www.positech.co.uk/content/explosion/explosiongenerator.html (The website also features a free explosion generator program to make more).

The animation however was on a sprite sheet that had a solid background and I needed a transparent background. So, I took the time to cut them out using an alpha layer and then saved them to individual files. I have upload the cutout files as I figure it is likely others might find them useful. The below file includes a photoshop file with all the different frames of the explosion on different layers as well as all of the frames of the explosion separated into individual .png files with transparent backgrounds. These images are royalty free so please feel free to use them any way you like.

Download animation with transparent background

UPDATE: Couple more free animated explosions can be found here

explosion_animation_sheet

Include an “or” Operator in a JavaScript Switch Statement

Posted in Programing, Web Development on July 4th, 2011 by Jarred – Comments Off on Include an “or” Operator in a JavaScript Switch Statement

I came across a situation where I needed a switch statement in JavaScript to do the exact same thing in multiple cases. For example:

switch (varAnimal)
{
   case ‘dog’:
   sameFunction();
   break;

   case ‘cat’:
   sameFunction();
   break;

   case ‘bird’:
   sameFunction();
   break;
}

While the above code works, if you have a long list of variables it is highly inefficient. To solve the problem I initially tried to use an “or” operator to try and test for the different values as you would do in an “if” statement. For example:

switch (varAnimal)
{
   case ‘dog’ || ‘cat’ || ‘bird’:
   sameFunction();
   break;
}

However this didn’t work. I found on a forum the below method which appears to accomplish what I was trying to do. It essentially lets you use an “or” operator to test for multiple cases which can save a lot of typing. For example:

switch (varAnimal)
{
   case ‘dog’: case ‘cat’: case ‘bird’:
   sameFunction();
   break;
}

Source: http://www.webdeveloper.com/forum/showthread.php?t=191879

7/11 Update

Posted in Entrepreneurship on July 3rd, 2011 by Jarred – Comments Off on 7/11 Update

Well It has been one month now since I started this blog experiment and I really don’t have much to show for my efforts yet. This blog (infobrink.com) is as of yet the only source of income I am tracking and I made $0.00 last month (however I did end up attracting a zillion spam bots). This comes as no surprise to me as I have not yet placed any advertizing on the site (I am waiting for it to get a reasonable amount of traffic before I mess with that).

I have been spending a lot of time on my first HTML5 game I want to release and try to monetize. I am a little disappointed that this is taking me so long to finish it, but it is almost done. I think in my original concept for the game was too complicated/ambitious and was going to take me way to long to finish, so I ended up deciding to “simplify” the game so that it was easier/faster to write the code. I think this was a good move and I need to be more careful in the future and take into consideration how long it will take me to code a game when I am in the design phase.

All in all I would guess so far I have spent around 250 hours programing the game (I started the game long before I started this blog). I know a veteran programer could likely do the same thing in a fraction of the time, but hey…It was my first game and I had lots to learn. I just hope that all this time I have invested will actually convert into some extra cash…I guess we will see.