+ Mf::Script::Status status = mState.script.doFile(loaderPath);
+ if (status != Mf::Script::SUCCESS)
+ {
+ std::string str;
+ mState.script[-1].get(str);
+
+ Mf::logScript("%s", str.c_str());
+ throw Mf::Exception(Mf::ErrorCode::SCRIPT_ERROR, str);
+ }
+
+ mState.script.getGlobalTable().pushField("scenes");
+ mState.script.getTop().get(mState.sceneList);
+ if (mState.sceneList.size() == 0)
+ {
+ Mf::logScript("no variable `scenes' within loader");
+ throw Mf::Exception(Mf::ErrorCode::SCRIPT_ERROR, "no scenes to load");
+ }
+}
+
+void GameLayer::advanceScene()
+{
+ if (mState.sceneList.size() != 0)
+ {
+ mState.scene = Scene::alloc(mState.sceneList[0]);
+ mState.sceneList.erase(mState.sceneList.begin());
+ mState.scene->load(mState.script);
+ }
+}
+
+
+GameLayer::GameLayer() :
+ mMusic("NightFusionIntro"),
+ mPunchSound("Thump")
+{
+ mMusic.setLooping(true);
+ mMusic.enqueue("NightFusionLoop");
+ mMusic.stream();
+
+ loadSceneLoader();
+ advanceScene(); // load the first scene
+
+ mState.heroine = Heroine::alloc();
+ mState.heroine->animation.startSequence("FlyDiagonallyUp");
+
+ Mf::Scalar a[6] = {0.0, 1.5, -0.5, 3.0, -2.0, 1.0};
+ mState.interp.init(a, 2.0, Mf::Interpolator::OSCILLATE);
+
+ setProjection();