Co co mit

This commit is contained in:
alexandre-pereira
2015-03-16 14:07:32 +01:00
parent 4ef3e7e8b3
commit f9251c68f9
10 changed files with 51 additions and 146 deletions

View File

@ -1,95 +1,3 @@
/* =============================================================================
RESET, BOX SIZING, & CLEARFIX
============================================================================= */
/*#jeu{
height: 100%;
width: 100%;
margin: 0;
padding: 0;
background-image:url("../pictures/setting_picture/fond.jpg");
background-attachment:fixed;
background-repeat:no-repeat;
background-position:100% 100%;
background-size:cover;
}*/
body
{
background-image:url("../pictures/setting_picture/fond.jpg");
background-attachment:fixed;
background-repeat:no-repeat;
background-position:100% 100%;
background-size:cover;
}
*,
*::before,
*::after {
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
/* =============================================================================
BASE
============================================================================= */
img {
display: block;
max-width: 100%;
height: auto;
}
/* =============================================================================
LAYOUT
============================================================================= */
/* wrapper */
.wrapper {
margin: 0 auto;
width: 100%;
/*min-width: 432px;*/
}
/* container */
/*
.container {
padding-top: 50px;*/
/* margin: 0 auto;
width: 96%;
max-width: 1128px;*/
}
/* =============================================================================
MEMORY GAME (mg)
============================================================================= */
/**
* Game container
*
* This is the overall container for the game. Different things get addead and
* removed from this container depending on the game state.
*/
.mg {
/* blank */
}
/**
* Game meta
*
* The game meta is the section that displays the level and moves. It's appended
* to the game container at the start, and shows the level the user selected
* and the number of moves the user has played.
*/
.mg__meta {
margin-bottom: 10px;
color: #28aadc;
@ -173,12 +81,7 @@ img {
text-align: center;
}
.mg__contents {
position: relative;
padding-bottom: 50%;
margin-left: 0%;
margin-right: 0%;
}
/**
* Game tiles
@ -482,7 +385,6 @@ img {
}
.mg__tile--outside {
background: url("/pictures/default/logo-bw.png") 50% 50% no-repeat;
background-color: #dcdee1;
box-shadow: 0 0 0 1px #787a80;
}

File diff suppressed because one or more lines are too long

View File

@ -31,10 +31,10 @@
*
*/
function Memory( options ) {
function Memory( options, level ) {
this.options = extend( {}, this.options );
extend( this.options, options );
this._init();
this._init(level);
}
/**
@ -44,7 +44,7 @@
* ready for game setup.
*/
Memory.prototype._init = function() {
Memory.prototype._init = function(level) {
this.game = document.createElement("div");
this.game.id = "mg";
this.game.className = "mg";
@ -65,7 +65,7 @@
this.gameMessages.id = "mg__onend";
this.gameMessages.className = "mg__onend";
this._setupGame();
this._setupGame(level);
};
/**
@ -85,7 +85,7 @@
* 3 : game is finished
*/
Memory.prototype._setupGame = function() {
Memory.prototype._setupGame = function(level) {
var self = this;
this.gameState = 1;
this.cards = shuffle(this.options.cards);
@ -98,7 +98,7 @@
this.flippedTiles = 0;
this.chosenLevel = "";
this.numMoves = 0;
this._setupGameWrapper(3);
this._setupGameWrapper(level);
}
/**
@ -155,7 +155,7 @@
this.tilesHTML += '<div class="mg__tile mg__tile-' + n + '">\
<div class="mg__tile--inner" data-id="' + this.newCards[i]["id"] + '">\
<span class="mg__tile--outside"></span>\
<span class="mg__tile--inside"><img src="' + this.newCards[i]["img"] + '"></span>';
<span class="mg__tile--inside" style="background-image:url(' + this.newCards[i]["img"] + ');"></span>';
this.tilesHTML +='</div>';
@ -279,7 +279,7 @@
self.card1.classList.remove("flipped");
self.card2.classList.remove("flipped");
self._gameResetVars();
}, 900 );
}, 500 );
// plus one on the move counter
this._gameCounterPlusOne();