check if level is over when playing by mouse

This commit is contained in:
Gwenhael Le Moine 2011-07-12 19:05:21 +02:00
parent 7aa6186c68
commit 84133b8ec4

View file

@ -251,6 +251,15 @@ function start_loop( state, elt ) {
} }
} }
if ( won_or_not( state ) ) {
if ( state.level < levels.length - 1 ) {
state = load_level( levels, state.level + 1 );
}
else {
alert( "You won!" );
}
}
display_level( state, options.dom_place ); display_level( state, options.dom_place );
} }
}); });