Skip to content

Commit

Permalink
fix game.compare()
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspark committed Nov 2, 2024
1 parent f7787fb commit e05c338
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions js/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ var game = {
var lilypads = {};
var frogs = {};
var correct = true;
let code = $('#code');

$('.frog').each(function() {
var position = $(this).position();
Expand All @@ -434,24 +433,15 @@ var game = {
});

if (correct) {
if (!code.hasClass('correct')) {
game.audio.correct.play();
}

code.addClass('correct');

if (game.solved.indexOf(level.name) === -1) {
if ($.inArray(level.name, game.solved) === -1) {
game.solved.push(level.name);
}

if (game.solved.length > game.max) {
game.max = game.solved.length;
}

$('[data-level=' + game.level + ']').addClass('solved');
$('#next').removeClass().addClass('animated animation');
$('#next').removeClass('disabled').addClass('animated animation');
} else {
code.removeClass('correct');
game.changed = true;
$('#next').removeClass('animated animation').addClass('disabled');
}
},

Expand Down

0 comments on commit e05c338

Please sign in to comment.