Styling & difficulty adjustment
Styling for difficulty option buttons Easy mode slightly harder First click now reveals a tile with no adjacent mines
This commit is contained in:
parent
0c2faebd03
commit
7661aa3dcc
32
index.html
32
index.html
|
@ -75,6 +75,7 @@
|
|||
|
||||
#setup h2,
|
||||
#setup label {
|
||||
margin: 4vmin 3.5vmin;
|
||||
font-size: 6vmin;
|
||||
color: #fe7ac6;
|
||||
text-shadow: 0.5vmin 0.5vmin 0 #a4f4b4; /* x y blur-radius colour */
|
||||
|
@ -85,6 +86,17 @@
|
|||
left: 10vmin;
|
||||
}
|
||||
|
||||
input[type="radio"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* after checked input */
|
||||
input:checked + label {
|
||||
border: 1vmin dotted #a4f4b4;
|
||||
border-radius: 2vmin;
|
||||
padding: 1vmin 2vmin;
|
||||
}
|
||||
|
||||
button {
|
||||
font-family: Helsinki;
|
||||
font-size: 6vmin;
|
||||
|
@ -424,7 +436,7 @@
|
|||
$('input[type="radio"]').on("change", function() {
|
||||
switch ($(this).val()) {
|
||||
case "easy":
|
||||
mineChance = 0.1;
|
||||
mineChance = 0.13;
|
||||
break;
|
||||
case "normal":
|
||||
mineChance = 0.2;
|
||||
|
@ -445,6 +457,8 @@
|
|||
|
||||
$('#setup button').on("click", function() {
|
||||
//reset stats
|
||||
firstClick = true;
|
||||
|
||||
score = 0;
|
||||
mines = 0;
|
||||
|
||||
|
@ -456,8 +470,20 @@
|
|||
|
||||
$.fn.leftClick = function() {
|
||||
//don't want first click to be a mine
|
||||
if (firstClick && $(this).isMine()) {
|
||||
$(this).removeClass("mine");
|
||||
if (firstClick) {
|
||||
var x = $(this).getX();
|
||||
x = (x >= 1) ? x : 1;
|
||||
x = (x <= gameBoardWidth - 2) ? x : gameBoardWidth - 2;
|
||||
|
||||
var y = $(this).getY();
|
||||
y = (y >= 1) ? y : 1;
|
||||
y = (y <= gameBoardHeight - 2) ? y : gameBoardHeight - 2;
|
||||
|
||||
$('ul').eq(y - 1).children().slice(x - 1).filter(':lt(3)').removeClass("mine");
|
||||
$('ul').eq(y ).children().slice(x - 1).filter(':lt(3)').removeClass("mine");
|
||||
$('ul').eq(y + 1).children().slice(x - 1).filter(':lt(3)').removeClass("mine");
|
||||
|
||||
firstClick = false;
|
||||
}
|
||||
|
||||
if ($(this).hasClass("flagged")) {
|
||||
|
|
Loading…
Reference in New Issue