Or hell, just click the button:
Sunday, August 12th, 3pm – 5pm, @ Hive76 Register
The first game is, as promised, Pong. You can see the game in action here: http://wedusc.com/games/pong.html
And you can read the source code online in my GitHub repository here: https://github.com/capnmidnight/JS_Game_Programming_Class/blob/master/pong.html
I’ll have printouts for everyone when you get here. If this is your first time trying to read code, try not to cross your eyes too much. We’ll cover how to read code along the way.
Though this game is pretty simple, it has a few interesting features…
- Stupid AI: There is a really basic AI running the second paddle. It’s pretty dumb, but the astute reader should be able to figure out how to make it tougher.
- Cross Platform: it runs in all of the latest versions of Internet Explorer, Chrome, Safari, Firefox, and Opera on Windows 7, as well as Safari on the iPad 2 and the default Web browser in Android 2.3. There is a small amount of browser-specific code to handle the difference between mouse events on desktops and touch events on mobile devices. I suspect it will run exactly the same on all of the other operating systems that these browsers run on.
- Comments: there are more comments than code in this file. Hopefully, someone reading it will get an idea of why I did many things as I did.
- Single File: everything in the game is in that file. Normally, one would split such a thing up into multiple files, but as a learning tool, I think it’s better to have everything in one file.