From 84133b8ec40f0918acd11af76ab27f11be8c863b Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Tue, 12 Jul 2011 19:05:21 +0200 Subject: [PATCH] check if level is over when playing by mouse --- star.js/js/star.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/star.js/js/star.js b/star.js/js/star.js index 0890830..25644c1 100644 --- a/star.js/js/star.js +++ b/star.js/js/star.js @@ -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 ); } });