DanmakuJSON "shift" Action

Shifts the bullet-source which executes this action.

Required Parameters

ParameterTypeDescription
xTermThe offset on the X-axis (Optional if y is present)
yTermThe offset on the Y-axis (Optional if x is present)

Optional Parameters

ParameterTypeDescription
durationTermThe duration (in seconds) of the transition from the current position to the given target position. (Default value: 0.0)
interpolationInterpolationTypeSpecifies which interpolation-algorithm will be used. (Default value: "linear")
positionRelationSpecifies if the given position is absolute (in world space) or relative to the current position. (Default value: "relative")
waitbool

Specifies if the behaviour of the executing bullet-source will be paused until this action has finished (Default value: false)


Remarks

Note, that this action only changes the position - use rotate to change the rotation of a bullet-source.

Examples

root:
{
    repeatBehaviour: true,
    angle: 180,
    behaviour: 
    [
        # Shoot 20 bullets
        {repeat: {times: 20, actions:
        [
            # Shoot the default bullet
            shoot,

            # Wait for 0.3 seconds before continuing
            {wait: {duration: 0.3}}
        ]}},

        # Wait for one second before continuing
        {wait: {duration: 1}}
    ]
},

bullets:
{
    Default:
    {
        speed: 2,
        lifetime: 4,
        behaviour:
        [
            # Shift by 5 on the X-Axis within 1 second... 
            {shift: {x: 5,
                     duration: 1,
                     interpolation: "easeOutSine",
                     wait: true}},

            # Shift by -10 on the X-Axis and shift by 2
            # on the Y-Axis within 1 second... 
            {shift: {x: -10,
                     y: 2,
                     duration: 1,
                     interpolation: "easeInOutSine",
                     wait: true}},

            # Smoothly accelerate to 7 within one second...
            {changeSpeed: {speed: 10,
                           duration: 1,
                           interpolation: "easeInSine"}}
        ]
    }
}

 


Leave a comment