XOML – Booty5 Editor Data


The Booty5 game editor exports data for your game in a JSON format called XOML. The Xoml class reads this data and converts it into scenes, game objects and resources etc..

Booty5 will export a JSON file for each of your scenes as well as globals,js that contains information about all of your global app resources.

To parse a XOML JSON file, you need to create an instance of the Xoml class then call Xoml.parseResources() to parse the file. Lets take a look at a quick example:

Below is a small example of an exported XOML file:

Now lets take a look at how we parse the data to generate Booty5 compatible objects:


Post Loading Scenes

In the Booty5 game editor you can mark scenes as “do not load” which means they will not be parsed when the app begins. At a later date you will need to load this exported scene XOML, the example below shows how to do this:

In the above example we create an instance of the Xoml class then call parseResources(), passing in the app as the place to put global resources and the object that contains the XOML JSON data. Note that all exported scenes data is placed in the b5.data object, so accessing for example a scene called level1 you would pass [b5.data["level1"]] as xoml_data.


Creating Resources from XOML templates

You can create a copy of any object / resource that exists in the XOML JSON data, you can think of the XOML data as a collection of templates. Lets take a quick look at an example:

In the above example we find the XOML template for the ball actor. We create an instance of the Xoml class that parses this template and creates a ball Actor object from it. We pass in the scene that contains resources that the ball object is dependent upon, such as bitmaps, timelines etc… Finally we modify the generated Actor object to add our own changes, such as give it a random fill style, a position and a velocity.

Next Topic:

3,398 total views, 1 views today