Manual: BarrageBullet System

Overview

The Barrage System is a system that uses a dedicated action, “Fire Barrage Bullet”, to launch lightweight bullets with minimal functionality.

This system can fire hundreds of bullets at once, but its functionality is highly limited. You cannot assign visual scripts to bullets or animate them.

Contact with barrage bullets can only be detected using the dedicated condition “Collide With Barrage Bullet”. Traditional attack or wall collision detection cannot be used.

For bullets requiring complex behavior, use the conventional “Fire Bullet” action.

Features Available with “Fire Barrage”

  • Choose from Omni-directional, Rapid Fire, or Shotgun firing types.
  • Specify the firing position.
  • Specify the firing target.
  • Choose post-firing behavior from Straight, Curved, Direction Change, Split, or Homing.
  • Specify the bullet’s sprite.
  • Bullets face 0 degrees (to the right) and automatically rotate according to their movement direction.
  • Specify bullet speed, and optionally accelerate or decelerate after firing.
  • Specify hitbox dimensions and collision layers.
  • Specify bullet damage and attributes (note: damage is not automatically processed; manual setup is required).

Examples of Generating “Barrage Patterns”

“Flower Pattern”

Generate multiple “Omni-directional” + “Curved” bullets simultaneously. Set the curve angles to opposite values (e.g., +0.3 degrees and –0.3 degrees) to create a beautiful flower pattern.

Adding rotation effects transforms it into a washing-machine-like pattern.

“Grid Pattern”

Use multiple “Rapid Fire” + “Straight” bullets, offsetting their firing positions. Adding direction changes or split effects can also create interesting results.

“Player-Targeting”

Set the target to the player. Adding offsets creates “near-miss” bullets, while adding homing creates predictive aiming effects.

Barrage and Scripts

Bullets generated via the barrage system cannot have scripts assigned to them.

Therefore, you must implement behaviors in the script of the object that collides with the barrage, using the “Collide With Barrage Bullet” condition.

Features Available with “Collide With Barrage Bullet”

  • Detect collisions between an object’s HitArea and barrage hitboxes. Detection occurs when the HitArea2D’s layer mask matches the barrage’s layer.
  • Delete barrage bullets upon collision (commonly used for bombs or grazing detection).
  • When deleting barrage bullets, convert them into other objects or Godot scenes with a specified probability (primarily for bomb effects).
  • Store the damage and attribute of the collided barrage bullet into specified variables.

Practical Examples Using “Collide With Barrage Bullet”

“Bomb”

Create a game object with a HitArea, setting its layer mask to match the barrage layer, effectively defining the bomb’s attack range.
(Note: This step is slightly complex, as AttackArea cannot detect barrage collisions.)

Use visual scripting to enable the HitArea only during the explosion, then disable it afterward. After the explosion, set up a “Collide With Barrage Bullet” condition with the option “Delete Collided Barrage Bullet” enabled.

  • When bombs delete barrage bullets to generate score items:
    Specify the drop item. Since this conversion process has similar overhead to spawning regular game objects, generating many objects simultaneously may cause performance issues. We recommend setting a low drop probability, such as 10%.

  • When bombs should also damage enemies:
    Simply execute standard damage processing simultaneously—set up an AttackArea2D and assign damage values.

“Grazing”

Create a dedicated game object for grazing processing and use it as a child node.

  • Grazing Object Setup:
    Set a HitArea larger than the parent object. In visual scripting, when “Collide With Barrage Bullet” triggers, play grazing animations or particle effects and increase score, etc.

“Barrage Damage / Attribute Processing”

Since the standard damage system cannot be used, manual setup is required.

Store:

  • Barrage damage into Variable A

  • Barrage attribute into Variable B

  • For simple damage application:
    In the damage processing state, implement logic such as “Reduce HP by the value of Variable A”.

  • For attribute-dependent effects:
    In state transition conditions, set “Variable B equals specified value” to branch processing accordingly.

Generating Bullet Hell with GDScript

You can generate bullet hell by passing a class that sets up bullet movement and behavior to the Barrage Manager API.

Example:
A barrage that fires bullets in all directions at 36-degree intervals and disappears 5 seconds after firing.

# 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])