Manual: BulletHell Sample Project

In this tutorial, we explain the structure and internal mechanisms of BulletHellSample, a sample game that demonstrates a bullet hell (danmaku) system.


◆ Game Overview

This is a game where you defeat a boss with 500 HP that fires bullet hell patterns, using shots and bombs.
Since this is a sample project, the game ends once the boss is defeated.

Controls

  • Arrow Keys: Move
  • Z Key: Shot
  • X Key: Bomb

Common bullet hell mechanics such as grazing and bullet clearing via bombs are implemented.


Game Scene Structure

The game consists of a single scene: test_scene.tscn.
There are no scene transitions.


Object Structure

Player

player.tscn is the player character scene.

It has the following child nodes:

  • GrazeObject.tscn: Handles grazing detection
  • player_hit_checker.tscn: Handles damage (hit) detection

Enemy

enemy.tscn is the enemy (boss) scene.

It has the following child node:

  • damage_checker.tscn: Handles damage detection

Feature Implementation Details

Enemy Bullet Patterns

The enemy simply fires bullet patterns at fixed time intervals.

The patterns are:

  1. Accelerating omnidirectional bullets
  2. A shotgun-style pattern combined with movement
  3. Player-targeted splitting bullets fired from the edges of the stage
  4. A flower-shaped pattern combining omnidirectional bullet groups
  5. Simple geometric patterns using direction-changing bullets

Because bullet patterns require sound effects to be played repeatedly, this is implemented by playing AudioStreamPlayer sounds via an AnimationPlayer node.

This approach is used because suitable sound assets are not currently available.
Ideally, each bullet pattern should have its own appropriate sound effect and play it directly.

  • In the current bullet system, there is no way to stop active bullet generation, so bullets that have already begun spawning will continue even after the enemy is defeated.
    This will be fixed in a future update by adding a bullet stop mechanism.
    For now, this can be avoided by not using repeat processing and instead separating logic into states with manual repeat handling.

Player Normal Shot Patterns

The player fires four different bullet patterns simultaneously within a single state.

At present, rapid-fire bullets cannot be fired with an explicitly specified direction.
To work around this, the system fires bullets toward a very distant global coordinate, which effectively simulates directional firing.

  • An update is planned to allow firing with explicit direction settings.

Grazing System

Grazing is implemented by attaching GrazeObject.tscn as a child node to the player.

This object has a larger collision area than the player’s hitbox.
When it collides with enemy bullets, it:

  • Emits grazing particles
  • Increases the score

Damage Handling

Damage handling for both the player and the enemy is implemented using separate child objects.

There are two main reasons for this:

  1. To prevent the currently running state from being interrupted by damage events
  2. To clearly separate grazing and damage hit detection
  • In ACTION GAME MAKER, HitArea2D checks collisions against all HitAreas under the root node, which means child node hitboxes are also detected.
    This issue can be avoided by generating hit areas as child objects instead of child nodes, but in this project, child nodes are used to make collision positions easier to visually confirm.

Bullet Layer Configuration

The layers are configured as follows:

  • Player: Layer 1
  • Enemy: Layer 2
  • Graze detection: Layer 3

Bullet layers:

  • Enemy bullets: Layers 1 and 3
  • Player bullets: Layer 2

Bomb Implementation

Bombs are implemented as regular bullets, not as bullet patterns.

bomb.tscn is the bomb scene.

Features:

  • A collision area covering the entire screen

  • Clears bullets it collides with

  • Converts cleared bullets into score items with a 10% probability

  • Deals damage to the enemy itself via an attack hitbox

  • Converting bullets into score items involves object creation, which is a relatively heavy process.
    If the conversion rate is set to 100%, performance issues will occur.
    Countermeasures for this issue are currently under consideration.


Score Items

To reduce the processing cost of object creation, score items are implemented using GDScript.

  • Scene: score_test.tscn
  • Behavior:
    • Moves toward the player
    • Disappears when within a certain distance
    • Increases or decreases a specified variable

You can customize values in the Score node Inspector:

  • PickUpRadius: Collision detection distance
  • PullSpeed: Movement speed
  • Group: Target group to move toward
  • Project Variable: Name of the project variable to modify
  • Variable Add: Amount to add