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.