Skip to content

Commit eb8d3cc

Browse files
committed
No longer injects update into a Scene, and now calls step from init onwards.
1 parent f034883 commit eb8d3cc

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

src/scene/SceneManager.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ var SceneManager = new Class({
540540
{
541541
var sys = this.scenes[i].sys;
542542

543-
if (sys.settings.status === CONST.RUNNING)
543+
if (sys.settings.status > CONST.START && sys.settings.status <= CONST.RUNNING)
544544
{
545545
sys.step(time, delta);
546546
}
@@ -617,6 +617,12 @@ var SceneManager = new Class({
617617
}
618618
}
619619

620+
// If the Scene has an update function we'll set it now, otherwise it'll remain as NOOP
621+
if (scene.update)
622+
{
623+
sys.sceneUpdate = scene.update;
624+
}
625+
620626
settings.status = CONST.RUNNING;
621627
},
622628

@@ -660,11 +666,6 @@ var SceneManager = new Class({
660666

661667
newScene.sys.init(this.game);
662668

663-
if (!newScene.update)
664-
{
665-
newScene.update = NOOP;
666-
}
667-
668669
return newScene;
669670
}
670671
},
@@ -736,12 +737,6 @@ var SceneManager = new Class({
736737
{
737738
var sceneCallback = GetValue(sceneConfig, defaults[i], null);
738739

739-
// Must always have an update function, no matter what (the rest are optional)
740-
if (defaults[i] === 'update' && !sceneCallback)
741-
{
742-
sceneCallback = NOOP;
743-
}
744-
745740
if (sceneCallback)
746741
{
747742
newScene[defaults[i]] = sceneCallback;

0 commit comments

Comments
 (0)