• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

My first game made with Javascript

Status
Not open for further replies.
Level 5
Joined
Feb 1, 2009
Messages
111
Hi,

Wanted to share my javascript game here on hive. Its a spin on the classic game 'concentration' where you match 2 identical images and get a score.

Try it out and post a high score and let me know what you thought of my game !

I'm anxious to hear replies. Best viewed in google chrome !

http://jsgame.tk
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
The game seems to work fine, but the code could be improved.

First of all, the HTML itself has some issues, such as images that are closed with </img> while image tags are inline (e.g. <img src="something" />) and a <th> tag mistakenly closed with </td>.
I am not sure what's the idea of having your actual page in a frame, do you not control the front page? If you do, just use it directly, and update it to HTML5 tags like you did in the frame.

As to the JS itself, you are repetitively querying the document for the same elements instead of setting them to variables, this is both slow (a non-issue in this case), and mostly makes your code larger and messier.
For example, simply setting something like this
JavaScript:
var table = document.getElementsByTagName("table")
will shorten and simplify your code by quite a lot.

The first few lines where you set styles should be done ideally via CSS, not JS.

On the game code I am not going to comment, because for some unknown reason you obfuscated it.

In any case, good job on your first game, may there be more where that came from. :)
 
Last edited:
Status
Not open for further replies.
Top