@@ -6,6 +6,7 @@ function Game(stage,xocolor,doc,datastore,activity,sizepalette){
66 this . colours = [ xocolor . stroke , xocolor . fill ] ;
77 this . level = 4 ;
88 this . turns = 1 ;
9+ this . isgameOver = false ;
910
1011 this . gridwidth = 7 ;
1112 this . gridheight = 7 ;
@@ -154,7 +155,9 @@ function Game(stage,xocolor,doc,datastore,activity,sizepalette){
154155 if ( this . startgridwidth < this . gridwidth ) {
155156 this . startgridwidth ++ ;
156157 this . startgridheight ++ ;
158+
157159 }
160+ this . isgameOver = true ;
158161 this . palette . setUsed ( ) ;
159162 var t = this ;
160163 this . newGameTimeout = setTimeout ( function ( ) { t . newGame ( ) ; } , 2000 ) ;
@@ -193,11 +196,19 @@ function Game(stage,xocolor,doc,datastore,activity,sizepalette){
193196
194197 //Init
195198
199+
200+ // check to see if when window resized and new lvl abt to begin
201+ this . checkNewGame = function ( ) {
202+ if ( this . isgameOver == true ) {
203+ this . newGame ( )
204+ }
205+ }
196206 this . initialiseFromArray = function ( ) {
197207 clearTimeout ( this . newGameTimeout ) ;
198208 clearTimeout ( this . solveTimeout ) ;
199209 stage . removeAllChildren ( ) ;
200210 this . calculateDimensions ( ) ;
211+ this . checkNewGame ( )
201212 var incr = ( this . radius * 2 + this . margin ) ;
202213 var xp = ( stage . canvas . width - this . circleswidth ) / 2 + this . margin ;
203214 var yp = this . margin ;
@@ -243,6 +254,7 @@ function Game(stage,xocolor,doc,datastore,activity,sizepalette){
243254 //console.log(this.dotsarr);
244255 }
245256
257+
246258 this . calculateDimensions = function ( ) {
247259 var rad = this . canDoFromX ( ) ;
248260 if ( rad === false ) {
@@ -256,6 +268,7 @@ function Game(stage,xocolor,doc,datastore,activity,sizepalette){
256268 this . newGame = function ( ) {
257269 clearTimeout ( this . newGameTimeout ) ;
258270 clearTimeout ( this . solveTimeout ) ;
271+ this . isgameOver = false ;
259272 stage . removeAllChildren ( ) ;
260273 this . calculateDimensions ( ) ;
261274 this . initDots ( ) ;
0 commit comments