Oh boy tweening out the wazoo
@@ -1,11 +1,34 @@
1
1
class MinigameInitialiser
2
2
{
3
static StartFrogGame (parentScene)
3
static StartFrogGame (parentScene, originVector, originSize)
4
4
{
5
var subScene = new FrogScene(144, 64, 416, 512, Scene.DisplayModes.absolute);
5
let subScene = new FrogScene(144, 64, 416, 512, Scene.DisplayModes.absolute);
6
7
let endPos = subScene.real_position.getCopy();
8
let endSize = subScene.real_size.getCopy();
9
10
subScene.position = originVector.getCopy();
11
subScene.size = originSize.getCopy();
12
13
this.WindowTween(subScene, endPos, endSize, 1000);
6
14
7
15
subScene.gameSpeed = 1;
8
16
9
17
parentScene.loadChildScene(subScene);
10
18
}
19
20
static WindowTween (scene, endPosition, endSize, length)
21
{
22
new TWEEN.Tween(scene.position)
23
.to({ x: endPosition.x, y: endPosition.y }, length)
24
.easing(TWEEN.Easing.Elastic.Out)
25
.onUpdate((s) => console.log(scene.position))
26
.start();
27
28
new TWEEN.Tween(scene.size)
29
.to({ x: endSize.x, y: endSize.y }, length)
30
.easing(TWEEN.Easing.Elastic.Out)
31
.onUpdate((s) => console.log(scene.position))
32
.start();
33
}
11
34
}
@@ -1,11 +1,34 @@1
class MinigameInitialiser 1
class MinigameInitialiser 2
{2
{3
static StartFrogGame (parentScene)3
static StartFrogGame (parentScene, originVector, originSize)4
{4
{5
var subScene = new FrogScene(144, 64, 416, 512, Scene.DisplayModes.absolute);5
let subScene = new FrogScene(144, 64, 416, 512, Scene.DisplayModes.absolute);6
7
let endPos = subScene.real_position.getCopy();8
let endSize = subScene.real_size.getCopy();9
10
subScene.position = originVector.getCopy();11
subScene.size = originSize.getCopy();12
13
this.WindowTween(subScene, endPos, endSize, 1000);6
14
7
subScene.gameSpeed = 1;15
subScene.gameSpeed = 1;8
16
9
parentScene.loadChildScene(subScene);17
parentScene.loadChildScene(subScene);10
}18
}19
20
static WindowTween (scene, endPosition, endSize, length)21
{22
new TWEEN.Tween(scene.position)23
.to({ x: endPosition.x, y: endPosition.y }, length)24
.easing(TWEEN.Easing.Elastic.Out)25
.onUpdate((s) => console.log(scene.position))26
.start();27
28
new TWEEN.Tween(scene.size)29
.to({ x: endSize.x, y: endSize.y }, length)30
.easing(TWEEN.Easing.Elastic.Out)31
.onUpdate((s) => console.log(scene.position))32
.start();33
}11
}34
}