-
Notifications
You must be signed in to change notification settings - Fork 0
Guide Create Scene
Scenes are to FlevaR what frames are to Flash!
To create a scene, we call the flevar.createScene(name, init) method:
flevar.createScene("first_scene", function onload() {});The scene is then added to FlevaR's library.
All flobtive names must be unique to their flobtive.
See documentation for detailed naming conventions.
The init function defines what flobtives exist within that scene. When the scene is loaded, this function will be executed, with the scene itself as the first parameter, to allow accessing its properties:
flevar.createScene("first_scene", function onload(scene) {
scene.addPrefab("first_prefab");
scene.addPrefab("second_prefab");
});Note: The scene instance is also bound to the init function, so
this.addPrefab("first_prefab");would also work, unless using arrow functions.
To use a scene, we call flevar.useScene(name):
flevar.useScene("first_scene");This unloads any current scene and loads first_scene, triggering the init function and loading any flobtives defined in it.
But, we won't see anything just yet. We've been calling the scene.addPrefab method, but no prefabs currently exist yet.
Let's create our first flevaclip!