• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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