XOML API Reference


b5.Xoml

The Xoml class loads a XOML format JSON file (exported from the Booty5 game Editor) and turns it into Booty5 compatible objects, such as scenes, actors, resources etc..

Methods

parseResources(parent, objects) – Parse the XOML resources objects and turn it into Booty5 objects

  • parent – The parent where the generated objects will be placed usually an instance of the App
  • objects – XOML resources objects array

parseResource(parent, resource) – Parse the XOML resource object and turn it into Booty5 objects

  • parent – The parent where the generated objects will be placed usually an instance of the App or a Scene
  • resource – XOML resources object
  • Returns the created Booty5 parent object

findResource(objects, name, type) – Searches the XOML objects array / object for the named resource of the specified type

  • objects – XOML object or array of XOML objects to search
  • name – The name of the resource to find
  • type – The type of resource to find
  • Returns the found resource or null

Examples

Generate Booty5 objects from XOML

Here is a small example XOML file that was exported from the Booty5 game Editor:

And here is the code that loads it and converts it to Booty5 objects:

Dynamically creating an actor from XOML template

531 total views, 2 views today