Tutorial 3
#Tutorial 3
Now we're going to talk about resources. Resources are important on GAJSE because almost every external thing is a resource. Resources must be loaded first using the resources field on your main.json file. The resource fields points to some paths. That paths should contain a resources.json file. The resources.json defines resources and they are very simple.
{
"RESOURCE1" : "INTRO.ogv",
"RESOURCE2" : "SOMETHING_HAPPENS.ogv",
"LoveTheme" : "LoveTheme.ogg"
}
As you can see there are so simple. You can define a lot of paths with his resources.json and a resources.json file can have a lot of resources. These resources are loaded before the scene is displayed. The GAJSE APIs will ask you for the resource name instead of the filename. Here are some examples:
api.setBackgroundMusic("LoveTheme");
Limitation: Images from GAJSE JSON objects are still loaded using filenames because we want to preserve compatibility with Three.js