Javascript slideshow tutorial

Here is a great tutorial on a simple scrolling slideshow. You can define the time and its very easy to implement. Here is the code from the article:

Javascript:

<SCRIPT LANGUAGE="JavaScript">
<!--
var dimages=new Array();
var numImages=2;
for (i=0; i<numImages; i++)
{
  dimages[i]=new Image();
  dimages[i].src="images/image"+(i+1)+".jpg";
}
var curImage=-1;
function swapPicture()
{
  if (document.images)
  {
    var nextImage=curImage+1;
    if (nextImage>=numImages)
      nextImage=0;
    if (dimages[nextImage] && dimages[nextImage].complete)
    {
      var target=0;
      if (document.images.myImage)
        target=document.images.myImage;
      if (document.all && document.getElementById("myImage"))
        target=document.getElementById("myImage");

      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
        target.src=dimages[nextImage].src;
        curImage=nextImage;
      }
      setTimeout("swapPicture()", 5000);
    }
    else
    {
      setTimeout("swapPicture()", 500);
    }
  }
}
setTimeout("swapPicture()", 5000);
//-->
</SCRIPT>

Then here is the code to place it:

<IMG WIDTH=250 HEIGHT=250 ID="myImage" NAME="myImage"
  SRC="images/image0.gif"></IMG>

HTML5 for game development

Here is a great article that discusses all of the technologies that we tend to lump together when we discuss HTML5 and how they can be applied to game development. I think anyone interested in HTML5 should definitely read this article to get a better understanding of what we really mean when we say HTML5. If you plan to use HTML5 in your work, compare it to Flash, tout it as the next big thing, etc – You need to really understand each of the technologies discussed in this article otherwise you might be making uniformed decisions (my rant because of all the misinformation i hear on HTML5) The technologies discussed include:

HTML5
CSS3
DOM
Canvas
WebGL
SVG
Native Client
WebSockets
Node.js
Javascript

Here is a link to the article

Flash CS6 to HTML5

The following video demonstrates Adobe Flash’s CS6 to HTML5 conversion tool codenamed Wallaby. The tool converted my file in one second. It worked great in Safari but did not work in Firefox. I am not sure if Flash’s tool is not working or HTML5 is not working. I say this because of the compatibility issues I have with HTML5, especially in Firefox. Also, Adobe’s Wallaby tool was last updated on March 8th, which means that a new version is just around the corner. Overall, I am impressed it worked but need to test this with more advanced Flash files. I was not really surprised there was a compatibility issue as that is HTML5. Here is the video with the demonstration:

So you want to learn Javascript?

With the increasing popularity of Codeacademy (http://www.codecademy.com), a free online javascript course, many people are signing up to learn Javascript. This popularity is stemming from the current state of the economy, leaders saying that everyone should learn to code, and where our future jobs are going.

I think this is awesome and I believe having an understanding of basic computer logic is a great skill to have. This is why I push software like Gamemaker, Squeak, Scratch, etc. which require one to understand basic programming logic.I also teach HTML, CSS, Javascript, PHP, and Actionscript in my classes.

However, I do think people are jumping the gun a bit with Javascript. The reason why? Javascript by itself is rather useless. I would not tell someone to learn javascript unless they had a solid foundation in HTML and CSS first. You really cant do anything with javascript without HTML. Learning javascript without HTML/CSS is like learning to hold your breath, then being put into a deep swimming pool without knowing how to swim.

So while I believe learning Javascript is great and I think everyone should learn basic programming…at least the logic, I believe that you should understand HTML and CSS before jumping the gun and learning Javascript.

So for those who want to learn js, just take a few weeks and learn HTML and CSS first. They are both very easy to learn – the easiest languages. Then when you have that foundation learn javascript. Then when you understand js, start learning a database language like PHP or Ruby.