Skip to content

Commit 4228d06

Browse files
author
Lionel Laské
committed
Merge branch 'pr/1958' into dev
2 parents ae4b16f + 799a80e commit 4228d06

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3131
- Camera remains active when toggling off in QRCode activity (Web/Desktop) #1911
3232
- Delete key deleted wrong character in Calculator #1935
3333
- Fototoon don't handle window resize #559
34+
- Bug in Flip Activity when resize an ended game #1956
3435

3536
## [1.9.0] - 2025-03-25
3637
### Added

activities/Flip.activity/js/game.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)