add link between scene and game
@@ -12,6 +12,7 @@ class Game
12
12
loadScene(scene)
13
13
{
14
14
this.activeScenes.push(scene);
15
scene.Game = this;
15
16
}
16
17
17
18
update()
@@ -12,6 +12,7 @@ class Game12
loadScene(scene)12
loadScene(scene)13
{13
{14
this.activeScenes.push(scene);14
this.activeScenes.push(scene);15
scene.Game = this;15
}16
}16
17
17
update()18
update()@@ -59,4 +59,6 @@ function image(url, subImgTotal, perRow)
59
59
context.globalAlpha = oldAlpha;
60
60
}
61
61
}
62
63
console.log("Image loaded: " + url);
62
64
}
@@ -59,4 +59,6 @@ function image(url, subImgTotal, perRow)59
context.globalAlpha = oldAlpha;59
context.globalAlpha = oldAlpha;60
}60
}61
}61
}62
63
console.log("Image loaded: " + url);62
}64
}@@ -13,6 +13,8 @@ class Scene
13
13
cv_context = null;
14
14
destroyed = false;
15
15
16
game = null;
17
16
18
constructor(x, y, width, height, fullscreen = false)
17
19
{
18
20
Scene.idCount++;
@@ -36,6 +38,12 @@ class Scene
36
38
this.cv_context = this.cv_canvas.getContext('2d');
37
39
}
38
40
41
loadChildScene(scene)
42
{
43
scene.parentScene = this;
44
this.game.loadScene(scene);
45
}
46
39
47
destroy()
40
48
{
41
49
this.destroyed = true
@@ -13,6 +13,8 @@ class Scene13
cv_context = null;13
cv_context = null;14
destroyed = false;14
destroyed = false;15
15
16
game = null;17
16
constructor(x, y, width, height, fullscreen = false)18
constructor(x, y, width, height, fullscreen = false)17
{19
{18
Scene.idCount++;20
Scene.idCount++;@@ -36,6 +38,12 @@ class Scene36
this.cv_context = this.cv_canvas.getContext('2d');38
this.cv_context = this.cv_canvas.getContext('2d');37
}39
}38
40
41
loadChildScene(scene)42
{43
scene.parentScene = this;44
this.game.loadScene(scene);45
}46
39
destroy()47
destroy()40
{48
{41
this.destroyed = true49
this.destroyed = true