DanmakuJSON "aim" Action

Rotates the bullet-source, so that it directly points to a target (a player or enemy, for example).

Optional Parameters

ParameterTypeDescription
angleOffsetTermAn offset (in degrees) which will be added to the direction-angle between the bullet-source and the target. (Default value: 0.0)
duration TermThe duration (in seconds) for which the bullet-source will point at its target. (Default value: 0.0)
target TargetTypeSpecifies how the target will be determined. (Default value: "closest")
waitbool

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


Remarks

Once a valid target has been determined, it will be detained until this action has finished or if the target becomes null. If no target could be found or the target became null, this action will try with every tick to get a new valid target until its execution has finished.

Examples

root:
{
    repeatBehaviour: true,
    behaviour: 
    [
        # Shoot 20 aimed bullets
        {repeat: {times: 20, actions:
        [
            # Shoot "Aimed" straight down
            {shoot: {bullet: "Aimed", angle: 180}},

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

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


        # Shoot 20 homing bullets
        {repeat: {times: 20, actions:
        [
            # Shoot "Homing" straight down
            {shoot: {bullet: "Homing", angle: 180}},

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

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

bullets:
{
    Aimed:
    {
        speed: 4,
        lifetime: 4,
        behaviour:
        [
            # Wait for one second before continuing
            {wait: {duration: 1}},

            # Rotate towards the closest target
            # and keep the rotation...
            aim
        ]
    },

    Homing:
    {
        speed: 4,
        lifetime: 4,
        behaviour:
        [
            # Wait for one second before continuing
            {wait: {duration: 1}},

            # Follow the farthest target for one second 
            {aim: {target: "farthest", duration: 1.0}}
        ]
    }
}

 


Leave a comment