DanmakuJSON "set" Action

Sets a local variable to a given value.

Required Parameters

ParameterTypeDescription
var stringThe name of the variable
toTermThe value which will be assigned to the variable

Remarks

Local variables are referenced in Terms by a leading $ and can be defined with this action or they are passed as parameters by the call- or shoot-action. If a variable has not been defined before it is used, it will result to 0.0. Note, that variable-names can only consist of the letters A to Z (lower- and uppercase).

Examples

root:
{
    angle: 90,
    repeatBehaviour: true,
    behaviour:
    [
        # Set the variable "bulletCount" to 20...
        {set: {var: "bulletCount", to: 20}},

        # Set the variable "sign" to 1...
        {set: {var: "sign", to: 1}},

        {repeat: {times: 10, actions:
        [
            # Shoot some bullets... 
            {repeat: {times: "$bulletCount", actions:
            [
                # Shoot the default bullet...
                {shoot: {speed: 6}},

                # Rotate the root-emitter...
                {rotate: {angle: "10 * $sign"}},

                # Pause for 0.1 seconds...
                {wait: {duration: 0.1}}
            ]}},

            # Invert the variable "sign"...
            {set: {var: "sign", to: "-$sign"}}
        ]}}
    ]
}

 


Leave a comment