Fixed behaviour of row clearing
This commit is contained in:
parent
47e3ab689d
commit
cf0342e248
19
index.html
19
index.html
|
@ -164,21 +164,22 @@
|
|||
if (rowsToRemove.length == 0) return;
|
||||
|
||||
rowsToRemove.each(function() {
|
||||
score += $(this).children('.mine').length;
|
||||
|
||||
//add new row on bottom
|
||||
$('#game').append('<ul style="display: none;"></ul>');
|
||||
|
||||
$('#game').append('<ul></ul>');
|
||||
|
||||
for (var i = 0; i < gameBoardWidth; i++) {
|
||||
if (Math.random() < mineChance) {
|
||||
$('#game ul:last-child').append('<li class="mine"></li>');
|
||||
$('#game ul').last().append('<li class="mine"></li>');
|
||||
} else {
|
||||
$('#game ul:last-child').append('<li></li>');
|
||||
$('#game ul').last().append('<li></li>');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
inputEnabled = false;
|
||||
|
||||
//rowsToRemove.remove();
|
||||
inputEnabled = false;
|
||||
|
||||
rowsToRemove.slideUp("slow", function() {
|
||||
$(this).remove();
|
||||
|
@ -205,8 +206,6 @@
|
|||
$(this).addClass("revealed");
|
||||
});
|
||||
|
||||
inputEnabled = true;
|
||||
|
||||
//refresh last row to reflect new rows beneath
|
||||
$('li.revealed').last().parent().children('li.revealed').mousedown();
|
||||
|
||||
|
@ -214,8 +213,10 @@
|
|||
$('li.revealed:not(.mine):empty').mousedown();
|
||||
});
|
||||
|
||||
$('ul:hidden').show();
|
||||
//this is a bit of a hack :( oh well
|
||||
$('ul:gt(' + gameBoardHeight + ')').remove();
|
||||
|
||||
inputEnabled = true;
|
||||
}
|
||||
|
||||
$.fn.rowScore = function() {
|
||||
|
|
Loading…
Reference in New Issue