Follow mclelun on Twitter +deviantWatch mclelun +fan mclelun RSS Feed
mclelun
Design + Programming = Multitask
blog
JavaScript Pong Game

JavaScript Pong

Back then, most JavaScript usage I saw was just for something simple such as bookmark or pop up window. There weren’t many fancy examples but this is not true nowadays. Two years had pass since I heard about Ajax from a friend, I finally decide to spend some time on JavaScript.

JavaScript and ActionScript

Both JavaScript and ActionScript are based on ECMAScript which means they share identical syntax. So, I don’t really have a hard time to understand the basic of JavaScript.

JavaScript Game

For me, the best way to learn is to get my hands dirty instead of reading tons of text and did nothing. I manage did a simple Pong game even though my knowledge on JavaScript is limited.The game can be view at this page.

Pong (marketed as PONG) is one of the earliest arcade video games, and is a tennis sports game featuring simple two-dimensional graphics – wiki

Flash game is usually loop with an onEnterFrame event. But there aren’t any “frames” in JavaScript, so we will need to construct the game loop by using a setInterval() method. Both JavaScript and ActionScript’s setInterval is similar, which execute code periodically.

Of course this little game experiment I did doesn’t really show the power of what JavaScript could do. So, navigate to Google’s Chrome Experiments and have a look at some great experiments did by other PROgrammers.

Download

View JavaScript Pong Game
pong.js 2.69KB

JavaScript Framework

Besides writing your script from scratch, you could also utilize JavaScript framework which will ease your development process. Below are some of the many JavaScript frameworks available.
JQuery
MooTools
YUI
Prototype

spamthis
twitter facebook delicious stumbleupon technorati digg


One good spam feed to “JavaScript Pong Game”

  1. Nice graphics! I was just coding one myself with html5 audio in it.
    http://barrydegraaff.tk/pong/

    Cheers Barry

Leave a Good Spam

spam box
recent visitors
minifanfan



logo Copyright © 2010 mclelun.
Valid XHTML. Subscribe RSS rss.
spam eaten
293 spam!