DanmakuJSON "call" Action

Calls a procedure with the executing bullet-source as its context.

Required Parameters

ParameterTypeDescription
procedurestringThe name of the procedure to be called

Optional Parameters

ParameterTypeDescription
paramsVariableMapPasses a set of variables to the procedure

Remarks

Note, that actions in a procedure which pause the behaviour (wait, for example) will delay all actions following a procedure-call. Read more about procedures to learn how they work.

Examples

root:
{
    behaviour:
    [
        {repeat: {times: 20, actions:
        [
            # Call the procedure "FireSpray" and pass
            # the parameters "bullets" and "angle"...
            {call: {procedure: "FireSpray",
                params: {bullets: 10, angle: 180}
            }},

            # Wait for 1.5 seconds...
            {wait: {duration: 1.5}}
        ]}}
    ]
},

procedures:
{
    FireSpray:
    [
        # All actions will operate on the
        # bullet-source which called this procedure
        {repeat: {times: "$bullets", actions:
        [
            {shoot: {angle: "$angle + (20 * #random))",
                     speed: "4 + (4 * #random)"
            }},

            # Wait for 0.1 seconds...
            {wait: {duration: 0.1}}
        ]}}
    ]
}

 


Leave a comment