Thank you for purchasing my game. If you have any questions, please feel free to contact me here.
To install the game just upload the files to the server. you can select one of the four default maps: space
, heart
, default
or pyramid
. or create your own map.
there are also three set of tiles: flowers
, letters
and symbols
.
Below is an example with all available options and their defaults values:
1 2 3 4 5 6 | mahjong = new game.Mahjong({ sprite: "images/smooth.png" , // default sprite map: "space" , // default map maxUndo: 30, // how many moves can be undone timePenalty: 60000 // time penalty for shuffling (milliseconds) }); |
To create your own set of tiles follow the measures of the template in templates/photoshop
:
I know what you think, I suck at photoshop. Then creates a sprite of 36 tiles, like this:
You can create your own maps, just remember:
#
charactermaps/
1 2 3 4 5 6 | ::: ::: # : : |
1 2 3 4 5 | :: :: # these tiles are on the air : : |
There are three events you can subscribe:
To subscribe an event you use the method on
.
1 2 3 4 5 6 7 8 9 | var mahjong = new game.Mahjong(); mahjong.on( "gameover" , function (time) { alert( "you lose" ); }); mahjong.on( "finish" , function (time) { alert( "it takes you " + time + " to complete the game" ); }); |
This game imports three Javascript files.
To initialize the app create an instance of game.Mahjong()
* after the DOM is ready. you can customise the instance through the options.
1 2 3 4 5 | var mahjong = game.Mahjong(); // OR var mahjong = game.Mahjong({ map: "space" , }); |
*Use jQuery.ready
I've used the following code:
Jhonatan Salguero