Get subbuttons from menuManager
@@ -55,7 +55,6 @@ class Game
55
55
{
56
56
const promises = [];
57
57
const context = this;
58
console.log(imagesData);
59
58
60
59
for (var imageData of imagesData)
61
60
{
@@ -86,7 +85,7 @@ class Game
86
85
}
87
86
await Promise.all(promises);
88
87
89
console.log("all images loaded");
88
console.log("all images loaded ", this.images);
90
89
91
90
return this.images;
92
91
}
@@ -857,6 +856,11 @@ class Scene
857
856
858
857
this.removeCanvas();
859
858
859
if (this.primary && this.parentScene)
860
{
861
this.parentScene.setPrimary();
862
}
863
860
864
this.destroyed = true;
861
865
}
862
866
}
@@ -55,7 +55,6 @@ class Game55
{55
{56
const promises = [];56
const promises = [];57
const context = this;57
const context = this;58
console.log(imagesData);59
58
60
for (var imageData of imagesData)59
for (var imageData of imagesData)61
{60
{@@ -86,7 +85,7 @@ class Game86
}85
}87
await Promise.all(promises);86
await Promise.all(promises);88
87
89
console.log("all images loaded");88
console.log("all images loaded ", this.images);90
89
91
return this.images;90
return this.images;92
}91
}@@ -857,6 +856,11 @@ class Scene857
856
858
this.removeCanvas();857
this.removeCanvas();859
858
859
if (this.primary && this.parentScene)860
{861
this.parentScene.setPrimary();862
}863
860
this.destroyed = true;864
this.destroyed = true;861
}865
}862
}866
}@@ -29,6 +29,8 @@ class FrogScene extends Scene
29
29
30
30
externalFruitCurrentPos = null;
31
31
32
windowDestroyTweens = [];
33
32
34
constructor (x, y, width, height, displayMode = 0)
33
35
{
34
36
super(x, y, width, height, displayMode);
@@ -71,7 +73,17 @@ class FrogScene extends Scene
71
73
{
72
74
return;
73
75
}
74
this.destroy();
76
if (this.windowDestroyTweens.length > 0)
77
{
78
let gameButton = MenuManager.Instance.getSubButton("btnGames");
79
80
gameButton.moveToOpen(() => gameButton.moveToClose());
81
82
this.windowDestroyTweens.forEach(t => t.start());
83
this.windowDestroyTweens[0].onComplete(() => this.destroy());
84
85
this.windowDestroyTweens = [];
86
}
75
87
}
76
88
}
77
89
@@ -29,6 +29,8 @@ class FrogScene extends Scene29
29
30
externalFruitCurrentPos = null;30
externalFruitCurrentPos = null;31
31
32
windowDestroyTweens = [];33
32
constructor (x, y, width, height, displayMode = 0)34
constructor (x, y, width, height, displayMode = 0)33
{35
{34
super(x, y, width, height, displayMode);36
super(x, y, width, height, displayMode);@@ -71,7 +73,17 @@ class FrogScene extends Scene71
{73
{72
return;74
return;73
}75
}74
this.destroy();76
if (this.windowDestroyTweens.length > 0)77
{78
let gameButton = MenuManager.Instance.getSubButton("btnGames");79
80
gameButton.moveToOpen(() => gameButton.moveToClose());81
82
this.windowDestroyTweens.forEach(t => t.start());83
this.windowDestroyTweens[0].onComplete(() => this.destroy());84
85
this.windowDestroyTweens = [];86
}75
}87
}76
}88
}77
89
@@ -10,25 +10,42 @@ class MinigameInitialiser
10
10
subScene.position = originVector.getCopy();
11
11
subScene.size = originSize.getCopy();
12
12
13
this.WindowTween(subScene, endPos, endSize, 1000);
13
this.SpawnWindowTween(subScene, endPos, endSize, 1000);
14
14
15
15
subScene.gameSpeed = 1;
16
16
17
subScene.windowDestroyTweens = this.DestroyWindowTween(subScene, originVector, originSize, 600);
18
17
19
parentScene.loadChildScene(subScene);
20
21
subScene.setPrimary();
18
22
}
19
23
20
static WindowTween (scene, endPosition, endSize, length)
24
25
static SpawnWindowTween (scene, endPosition, endSize, length)
21
26
{
22
27
new TWEEN.Tween(scene.position)
23
28
.to({ x: endPosition.x, y: endPosition.y }, length)
24
29
.easing(TWEEN.Easing.Elastic.Out)
25
.onUpdate((s) => console.log(scene.position))
26
30
.start();
27
31
28
32
new TWEEN.Tween(scene.size)
29
33
.to({ x: endSize.x, y: endSize.y }, length)
30
34
.easing(TWEEN.Easing.Elastic.Out)
31
.onUpdate((s) => console.log(scene.position))
32
35
.start();
33
36
}
37
38
39
static DestroyWindowTween (scene, endPosition, endSize, length)
40
{
41
return [
42
new TWEEN.Tween(scene.position)
43
.to({ x: endPosition.x, y: endPosition.y }, length)
44
.easing(TWEEN.Easing.Cubic.Out),
45
46
new TWEEN.Tween(scene.size)
47
.to({ x: endSize.x, y: endSize.y }, length)
48
.easing(TWEEN.Easing.Cubic.Out)
49
];
50
}
34
51
}
@@ -10,25 +10,42 @@ class MinigameInitialiser10
subScene.position = originVector.getCopy();10
subScene.position = originVector.getCopy();11
subScene.size = originSize.getCopy();11
subScene.size = originSize.getCopy();12
12
13
this.WindowTween(subScene, endPos, endSize, 1000);13
this.SpawnWindowTween(subScene, endPos, endSize, 1000);14
14
15
subScene.gameSpeed = 1;15
subScene.gameSpeed = 1;16
16
17
subScene.windowDestroyTweens = this.DestroyWindowTween(subScene, originVector, originSize, 600);18
17
parentScene.loadChildScene(subScene);19
parentScene.loadChildScene(subScene);20
21
subScene.setPrimary();18
}22
}19
23
20
static WindowTween (scene, endPosition, endSize, length)24
25
static SpawnWindowTween (scene, endPosition, endSize, length)21
{26
{22
new TWEEN.Tween(scene.position)27
new TWEEN.Tween(scene.position)23
.to({ x: endPosition.x, y: endPosition.y }, length)28
.to({ x: endPosition.x, y: endPosition.y }, length)24
.easing(TWEEN.Easing.Elastic.Out)29
.easing(TWEEN.Easing.Elastic.Out)25
.onUpdate((s) => console.log(scene.position))26
.start();30
.start();27
31
28
new TWEEN.Tween(scene.size)32
new TWEEN.Tween(scene.size)29
.to({ x: endSize.x, y: endSize.y }, length)33
.to({ x: endSize.x, y: endSize.y }, length)30
.easing(TWEEN.Easing.Elastic.Out)34
.easing(TWEEN.Easing.Elastic.Out)31
.onUpdate((s) => console.log(scene.position))32
.start();35
.start();33
}36
}37
38
39
static DestroyWindowTween (scene, endPosition, endSize, length)40
{41
return [42
new TWEEN.Tween(scene.position)43
.to({ x: endPosition.x, y: endPosition.y }, length)44
.easing(TWEEN.Easing.Cubic.Out),45
46
new TWEEN.Tween(scene.size)47
.to({ x: endSize.x, y: endSize.y }, length)48
.easing(TWEEN.Easing.Cubic.Out)49
];50
}34
}51
}