546 - bombShield(int a, int script)
Sets the bomb invulnerability flag (a=0 false, a=1 true), the caller's ANM script will change to script when a bomb is active.
611 - etEx(int etId, int async, int type, float a, float b)
Adds bullet transformation to bullet manager etId, Transformation of flag type determines the specific behaviour of the bullet. Documentation can be found here.
BulletEffectType-67108864 - etExDelay(string et, string isAsync, string time)
Hide the bullet for time frames. During this time, it will not move, will be invisible and won't have a hitbox. If used as a first transformation, can be used to delay when the bullet actually appears.
6 - isDelayedSpawn
While this flag is set, the bullet will be invisible and not have a hitbox. This flag is cleared once the delay timer ends.
4 - short_timer
Integer value between -1 and 15 inclusive (by default -1). If non-negative, shooters using short_timer shoot their bullets and timer increments by 1 per frame until 15 is reached. Once 15, timer reset to -1 or 0 depending on Z key state.
5 - long_timer
Integer value between -1 and 120 inclusive (by default -1). If non-negative, shooters using long_timer shoot their bullets and timer increments by 1 per frame until 120 is reached. Once 120, timer reset to -1 or 0 depending on Z key state.
91 - floatTime(int slot, float var, int time, int mode, float start, float final)
In time frames using mode mode, variable var changes from start to final. slot is used to set the slot to be used by this ins, every enemy has 8 slots.
-9980 - F1
Local float variable, inherited by spawned enemies.
-9984 - I1
Local integer variable, inherited by spawned enemies.
-9989 - ANGLE_PLAYER
Angle from the enemy to the player.
-9962 - BOSS_Y
Final Y position of the boss.
-9990 - PLAYER_Y
Player's Y position.
-9963 - BOSS_X
Final X position of the boss.
-9991 - PLAYER_X
Player's X position.
81 - circlePos(float varX, float varY, float angle, float radius)
Performs following operation: varX = cos(angle) * radius and varY = cos(angle) * radius
-9981 - F0
Local float variable, inherited by spawned enemies.
300 - enmCreate(string sub, float x, float y, int hp, int score, int item)
Creates an enemy using subroutine sub at coordinates (x, y) (relative to position of the parent), health of created enemy is hp, score bonus is score and item drop is item.
601 - etOn(int etId)
Shoots bullet(s) using properties from bullet manager etId.
23 - wait(int time)
Stops sub execution for time frames.
1 - delete()
Returns to the top of current call stack.
2 - GAME_SPEED
The value controls by how much faster the game speed is run. This variable is often set to a number between 0 and 1. This value is often changed when a (final) boss dies or when a photo is taken. Its default value is 1.
-9985 - I0
Local integer variable, inherited by spawned enemies.
-9983 - I2
Local integer variable, inherited by spawned enemies.
-9982 - I3
Local integer variable, inherited by spawned enemies.
-9954 - ENEMY_HP
Enemy's current HP.
3 - goheiExists
A flag that determines if a gohei exists on-screen or not. Flag is set to true by active gohei. Flag is set to false if gohei goes off-screen or is despawning.
-9926 - GI0
Global integer value. Value is initialised to 0 on stage load but not on stage reset.
-9925 - GI1
Global integer value. Value is initialised to 0 on stage load but not on stage reset.
-9924 - GI2
Global integer value. Value is initialised to 0 on stage load but not on stage reset.
-9923 - GI3
Global integer value. Value is initialised to 0 on stage load but not on stage reset.
17 - distortion(int a)
Triggers distortion effects on the edge of the screen. The meaning of the argument is not entirely clear. SA uses a value of 1 to create distortion at the bottom of the screen, while UFO uses this same value to create distortion at the top.
539 - spell3(int id, int timeRate, int unused, string name)
Declares a spell-card with id id and name unused. The ID passed to the spell-creating function is id + difficulty - 2 (with easy=0, normal=1, ..., overdrive=5). timeRate determines how much time the spell circle takes to shrink (in frames), as well as how fast the spell bonus decreases.
514 - setInterrupt(int slot, int hp, int duration, string subroutine)
Sets an interrupt on slot slot. Once caller's HP reaches hp or duration frames have passed since this instruction was called, the caller will terminate all subroutines it's currently running and execute subroutine subroutine.
270 - enmCreate270(string sub, float x, float y, int hp, int score, int item)
Creates an enemy using subroutine sub at coordinates (x, y) (relative to position of the stage background camera), health of created enemy is hp, score bonus is score and item drop is item.
115 - timer_callback_threshold(int time)
Calls the callback function timer_callback_sub after time frames have passed.
10022 - SELF_TIME
Integer value that increases by 1 every in-game frame. This value is used by bosses and by functions such as timer_callback_threshold.
7 - has_been_inbounds
This flag is set when the enemy has been within bounds. The default value is false.
8 - is_in_bounds
This flag is set when the enemy is currently within bounds. This flag is false if it is out of bounds.
Bomb Despawning Enemies
Specifications
- Versions:
1.00 -
1.01 -
1.02 -
1.02a -
1.02b -
1.02c -
1.02d -
1.02e -
1.02f -
1.02h
- Difficulty:
Easy -
Normal -
Hard -
Lunatic -
Extra
- Mode:
Main game -
Practice mode
- Shottype:
ReimuA -
ReimuB -
MarisaA -
MarisaB
What happens
Using a bomb sometimes causes enemies to despawn. This only applies to enemies coming from the right side of the screen.

How it happens
Use a bomb right as an enemy is about to appear from off-screen. This more notably happens when the screen-shaking effect is extremely violent, which is with the shottypes ReimuB and MarisaB.
Why it happens
To know why this happens, we must first understand what makes an enemy despawn, and what bombing does to the screen.
Despawning conditions
For an enemy to despawn by leaving the screen, exactly two conditions must be fulfilled:
- The enemy must have been in bounds before at least once:
has_been_inboundsmust be true, - The enemy must currently be out of bounds.
(The purpose of the first point is to prevent the enemy from immediately despawning if the enemy spawns from off-screen)
To check whether the enemy has been in bounds or not, the game checks if any part of the enemy's sprite is within bounds. In pseudo code, it is written as follows::
boolean is_in_bounds(x, y, enemy_width, enemy_height):
if (x + enemy_width / 2) < 0:
return false
if (x - enemy_width / 2) > screen_width:
return false
if (y + enemy_height / 2) < 0:
return false
if (y - enemy_height / 2) > screen_height:
return false
return true
The origin (0, 0) is in the top left of the screen. To give more information to the previous function, an image below is given showing the coordinate system in this game:

Below is an example on how the enemy despawning process works:

has_been_inbounds = false, is_in_bounds = false). The second panel shows that the enemy has entered the screen (has_been_inbounds = true, is_in_bounds = true). The third panel shows the enemy exiting the screen and thus despawning (has_been_inbounds = true, is_in_bounds = false)Screenshaking effect
The screenshake effect is an effect that modifies the position of the screen as well as the size of the screen. The logic for screenshaking goes as follows:
- Pick a random number between 0 and 2.
- Depending on the random number:
- The screen's position moves slightly
- The screen's dimensions decrease slightly
- This logic is applied independently to both the X and Y axes.
The second point "The screen's dimensions decrease slightly" is the only part of interest. Below is shown pseudocode of the relevant part of the screenshake effect.
if (random_integer(0, 2) == 0) {
screen_width = 384.0
} else {
screen_width = 384.0 - screen_offset
}
if (random_integer(0, 2) == 0) {
screen_height = 448.0
} else {
screen_height = 448.0 - screen_offset
}
screen_offset is calculated as follows:
screen_offset(timer) = ((end_offset - start_offset) / effect_length) * timer + start_offset
This follows the linear equation y = mx + b with parameters:
ybeing the output (screen_offset)mbeing the slope: (end_offset-start_offset) /effect_lengthxbeing the independent variable (timer) starting from 0bbeing the y-intercept:start_offset
The values of effect_length, start_offset, and end_offset are hardcoded values that are specific to each character. Below is a table summarising the values for every case.
| Shottype | Bomb Trigger condition | effect_length | start_offset | end_offset |
|---|---|---|---|---|
| ReimuA | On orb explosion | 16 | 8 | 0 |
| ReimuB | First 60 frames | 60 | 2 | 6 |
| After first 60 frames | 80 | 20 | 0 | |
| MarisaA | First 120 frames | 120 | 4 | 1 |
| MarisaB | Frames 60-120 | 60 | 1 | 7 |
| After 120 frames | 200 | 24 | 0 |
The following image demonstrates the despawning process of a fairy. This has been done with ReimuB on Stage 6, with screen_offset being 20 on the x-axis.

has_been_inbounds = true, is_in_bounds = true). The second panel shows the screen shake effect with screen_offset = 20. The area in green is the area the field has been shrunk by (has_been_inbounds = true, is_in_bounds = false). The third panel shows that the enemy on the right has despawned.Pausing & desyncs
If you pause the game while the screen is shaking, the screen_width and screen_height reset to 384.0 and 448.0 respectively. This means that by repeatedly pause-buffering during periods where screen_offset is non-zero, you can manipulate the stage to retain a constant screen_width and screen_height of 384.0 and 448.0 respectively. However, performing this action will likely desync your replay. When watching back the replay, the screen_width and screen_height will not retain their initial values but will instead fluctuate based on screen_offset, which will despawn any entities that otherwise would have been there. Likewise, pause-buffering during a bomb will have the same effect where the replay may desync.
Links
Replays
- Replay
reimuAby "kana0603". Lunatic, ReimuA, 1.02h. 「June 1, 2025」. Download link (Note: Despawned Stage 6 ring fairies with a bomb) - Replay
reimuBby "kana0603". Lunatic, ReimuB, 1.02h. 「June 1, 2025」. Download link (Note: Despawned Stage 6 ring fairies with a bomb) - Replay
marisaAby "kana0603". Lunatic, MarisaA, 1.02h. 「June 1, 2025」. Download link (Note: Despawned Stage 6 ring fairies with a bomb) - Replay
marisaBby "kana0603". Lunatic, MarisaB, 1.02h. 「November 8, 2025」. Download link (Note: Despawned Stage 6 ring fairies with a bomb)
Videos
This section has no content yet. Would you like to add to this section? Contact me if you are interested!
All The Embodiment of Scarlet Devil pages: | |
|---|---|
| Boss Attack Skip · Dialogue Pause Desync · Bomb Pause Desync · ReimuA No Sound · Nightbird on Easy Difficulty · Bomb Despawning Enemies · Laser Midpoint Bug · Remilia's 2nd non-spell timer · MarisaB Backward Laser · Bullet Displacement Bug · Max power at 127 power · Persisting Bat State | All Desync-related pages: | All Bombs-related pages: |