Manual: BarrageBullet System

Overview

The Barrage system is a system that fires extremely lightweight bullets with only the minimum required functionality, using the dedicated execution action “Fire Barrage Bullet (FireBarrageBullet)”.

It is capable of firing hundreds of bullets at once, but its functionality is highly limited. You cannot assign visual scripts to the bullets themselves, nor can you animate them.

Contact with barrage bullets can only be detected through the dedicated condition “Collide With Barrage Bullet (CollideWithBarrageBullet)”.
They cannot be detected using conventional attack collision detection or wall collision detection.

For bullets that require complex behavior, please use the conventional “Fire Bullet” action instead.

What You Can Do with “Fire Barrage Bullet”

  • Choose the firing type from Omnidirectional, Rapid Fire, or Shotgun.
  • Specify the firing origin.
  • Specify a firing target.
  • Choose post-fire behavior from Straight, Curved, Direction Change, Split, or Homing.
  • Specify the bullet sprite.
  • Bullets automatically rotate based on their movement direction, treating 0 degrees (right) as the forward direction.
  • Specify bullet speed, including acceleration and deceleration after firing.
  • Specify hitbox size and collision layers.
  • Specify bullet attack power and attributes
    (however, damage processing is not handled automatically and must be set up manually).

Examples of Creating “Barrage Patterns”

“Flower Pattern”

Generate multiple bullets simultaneously using Omnidirectional + Curved bullets.
By setting opposing curve angles—such as +0.3 degrees for one bullet and –0.3 degrees for another—you can create a clean, flower-like pattern.

Adding rotation will turn it into a washing-machine-like pattern.

“Grid Pattern”

Use multiple Rapid Fire + Straight bullets and shift the firing origin offsets.
Adding direction changes or splitting can create interesting variations.

“Player-Targeted”

Set the player as the target.
By applying offsets, you can create bullets that intentionally miss the player (“aim-off” bullets), while adding homing behavior results in predictive, lead-style bullets.

Barrage and Scripting

Bullets generated by the Barrage system cannot have scripts attached to them.

Instead, all behavior is implemented through the script of the object that detects the collision, using the “Collide With Barrage Bullet” condition.

What You Can Do with “Collide With Barrage Bullet”

  • Detect contact between an object’s HitArea and a barrage bullet’s hitbox.
    Detection occurs when the HitArea2D layer mask matches the barrage bullet’s layer.
  • Remove the barrage bullet upon contact (useful for bombs or player damage).
  • When a barrage bullet is removed, you can convert it—based on a specified probability—into another object or a Godot scene. This is mainly used for bombs.
  • Store the contacted barrage bullet’s attack power and attribute into specified variables.

Practical Examples Using “Collide With Barrage Bullet”

“Bomb”

Create a game object with a HitArea whose layer mask matches the barrage bullet layer, equivalent to the bomb’s attack range.
(This is slightly complicated, but contact detection cannot be performed using AttackArea.)

Use visual scripting so that the HitArea becomes active only at the explosion timing and then disappears.
After the explosion, set a “Collide With Barrage Bullet” condition with the option to remove contacted barrage bullets enabled.

  • When deleting barrage bullets with a bomb and spawning score items
    Specify a drop item. Since this conversion process has a processing cost equivalent to normal game object generation, spawning many items at once can easily cause performance drops.
    It is recommended to keep the drop rate low, such as 10%.
  • When also dealing damage to enemies with the bomb
    Simply apply standard damage processing at the same time by setting up AttackArea2D and attack power as usual.

“Grazing”

Create a dedicated game object for handling grazing, and make it a child node.

  • Grazing object setup
    Set a HitArea that is larger than the parent object.
    Using visual scripting, configure behaviors such as playing grazing animations or particles and increasing score when “Collide With Barrage Bullet” is triggered.

“Barrage Damage / Attribute Handling”

Since the standard damage system cannot be used, damage handling must be set up manually.

Store:

  • Barrage damage in Variable A
  • Barrage attribute in Variable B
  • Applying simple damage
    In the damage processing state, set up logic such as “Reduce HP by the value of Variable A.”
  • Applying attribute-based effects
    Use transition link conditions like “If Variable B equals a specified value” to branch behavior accordingly.

Generating Barrages Using GDScript

You can generate barrages by passing a class that defines bullet movement and behavior to the Barrage Manager API.

Example:
A barrage that fires bullets in all directions at 36-degree intervals, where each bullet disappears 5 seconds after being fired.

# Create a command list for the bullet (vanish after 5 seconds)
var vanish_command = BarrageBulletVanishCommand.new()
var wait_command = BarrageBulletWaitCommand.new()
wait_command.wait_time = 5

# Assign the command list to the bullet action data
var bullet_action_data = BarrageActionData.new()
bullet_action_data.command_list = [wait_command, vanish_command]

# Create bullet data
var bullet_data = BarrageBulletData.new()
bullet_data.action_list = [bullet_action_data]
bullet_data.image_path = "res://〇〇.png"
bullet_data.speed = 100

# Create barrage data that fires in all directions
# Fire command
var fire_command = BarrageBulletFireCommand.new()
fire_command.bullet_data = bullet_data

# Direction data
var direction_data = BarrageBulletDirectionData.new()
direction_data.direction_type = 3 # Reference the previously fired angle (SEQUENCE in BulletML)
direction_data.angle = 36         # Angle interval between bullets

# Assign direction data to the fire command
fire_command.fire_direction_data = direction_data

# Create action data to pass to the repeat command
var repeat_command_action = BarrageActionData.new()
repeat_command_action.command_list = [fire_command]

# Create a repeat command that runs 10 times
var repeat_command = BarrageBulletRepeatCommand.new()
repeat_command.action_data = repeat_command_action
repeat_command.repeat_num = 10

# Create the barrage fire command list
var barrage_command_list = [repeat_command]

# Action data passed to the manager
var action_data = BarrageActionData.new()
action_data.command_list = barrage_command_list

# Pass the data to the barrage manager
BarragesManager.fire_barrage([action_data])