DanmakuJSON Custom Properties

You can add custom data to your bullet-patterns which can be used in your code, by defining the properties-element (containing a StringMap) on the top-level of your DanmakuJSON-file. See the documentation of the class DanmakuJSONFile to learn how you can access custom properties.

You can also add individual custom properties to your bullet-sources. Note, that the DanmakuContext makes use of the property "preset" to identify bullet- and emitter-presets in your bullet libraries. If you omit the preset-property, the associated key of a bullet-source ("MyBullet" in the following example) will be used to determine the according preset. See the documentation of the class DanmakuBulletSource to learn how you can access custom properties.

Example

root:
{
    behaviour:
    [
        # Root-emitter behaviour goes here...
    ]
},

# These properties can be used in your code...
properties:
{
    myProperty: "My value",
    foo: "bar"
},

bullets:
{
    # This bullet's key is "MyBullet"
    # but the preset-association is
    # overriden by the property "preset"
    MyBullet:
    {
        # These properties can be used
        # in your code...
        properties:
        {
            myProperty: "My value",

            # The property "preset" specifies,
            # which preset will be used by the
            # associated DanmakuContext
            preset: "Default"
        }
    }
}

Leave a comment