-
Test your might is a recreation of the mini-game from the original Mortal Kombat, released in 1992 by Midway. For kids growing up with a Sega Genesis in their home, this mini-game was a button-masher's paradise.
-
To see the original mini-game in action, see This Clip on YouTube.
- HTML
- The game makes use of HTML with image pre-loading, audio elements, and "fade to black" divs.
- CSS
- The game relies on a large amount of CSS which processes nearly all animatinos, scene transitions, and game field set up.
- JavaScript
- The game uses a large amount of JavaScript to provide game logic, and Player Constructor functions. In addition, the Player object's prototype has two added methods.
- jQuery
- All DOM manipulation is done exclusively with jQuery. In addition, the core bar-filling mechanic makes extensive use of jQuery animation
The core of the game's engine relies on two Objects - the Player
and the GameState
. These are created using Oject Constructor functions, and provide most of the game's scorekeeping and scene transition mechanics. Player
tracks each player's score, and has methods assigned to the Prototype allowing for the storing and incrementing of the player's score. The GameState
provides methods allowing scene transition, and retrieval of material names and levels.
Below is a sample of the Player
constructor function, and one of the methods on the Prototype.
this.number = number;
this.score = score;
}
Player.prototype.storeScore = function() {
let holderName = `${this.number}-score`;
localStorage.setItem(holderName, this.score);
};
- Author
- Alex Kibler
- Mortal Kombat was created by
- Midway Games
- Credits
- Sounds and background are from Amy Rose's Mortal Kombat Longplay video on YouTube.
- Classic sprites and additional sounds are from Mortal Kombat Warehouse, a fantastic resource dedicated to all of the classic Mortal Kombat games.
- This W3Schools article helped me in learning about jQuery animations, and how they could be controlled with event handlers.
While the game functions properly, there are still additional work that could be done.
- The game makes excessive use of the
setTimeout()
JavaScript method, often with multiple listed one after another. Maybe I could find a way to compartmentalize these? - Also, I would like to refactor additional functionality into the
Player
andGameState
Object methods, helping the code be a little more DRY.
- Add a Character Select screen, complete with more playable characters to choose from.
- Add a High Scores table at the end of the game, displaying the best scores ever.
- Add secret characters, maybe with a combination of key presses?
- Add additional backdrops, with a randomization algorithm.