Spelunky is © 2008, 2009 Derek Yu and Mossmouth, LLC, and is used under the [Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt). spelunky.ai is an unofficial fan project, not affiliated with or endorsed by Mossmouth. The game and its assets may not be sold.

Music by George Buzinkai and Jonathan Perry; sound effects made in SFXR. From Spelunky Classic 1.1, © 2008, 2009 Derek Yu and Mossmouth, LLC.

# Explosions break blocks off screen

From the spelunky.ai wiki: <https://spelunky.ai/wiki/explosions-break-blocks-off-screen>.

Explosions break blocks off screen is a quirk of Spelunky Classic in which an explosion out of sight breaks blocks as one on the screen does.

| Quirk     |                                                                                                                                                                                                                                                                                                                                                                       |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Status    | GML + Oracle                                                                                                                                                                                                                                                                                                                                                          |
| Where     | [`objects/oExplosion/collision_oSolid.gml:1`](https://spelunky.ai/wiki/source/objects/oExplosion/collision_oSolid#L1)                                                                                                                                                                                                                                                 |
| Pinned by | [`fidelity/replays/temple-seed-2-bomb-off-screen.txt`](https://github.com/851-labs/spelunky/blob/33760636fec777769ce826d506b800fba381da4e/fidelity/replays/temple-seed-2-bomb-off-screen.txt)                                                                                                                                                                         |
| Row       | [docs/quirks.md §1, Bugs and leftovers in the 1.1 source](https://github.com/851-labs/spelunky/blob/33760636fec777769ce826d506b800fba381da4e/docs/quirks.md#1-bugs-and-leftovers-in-the-11-source): [“An explosion breaks blocks off the screen too.”](https://github.com/851-labs/spelunky/blob/33760636fec777769ce826d506b800fba381da4e/docs/quirks.md?plain=1#L72) |

A [Bomb](https://spelunky.ai/wiki/bomb) that goes off out of sight breaks the blocks around it as one on the screen does. The code that
breaks them has a test that looks meant to spare blocks off the screen, everywhere but the
[Tutorial](https://spelunky.ai/wiki/tutorial), and the test is always passed.

## What happens

In the Temple, the player drops a bomb beside a [Damsel](https://spelunky.ai/wiki/damsel) and runs left, until the bomb is far past the
right edge of the screen. It goes off there, out of sight: the screen shakes. When he walks back, the floor where
the bomb lay is gone, and he drops into the hole[^1].

**Clip: A bomb breaks the floor off the screen.** In the Temple, the player drops a bomb beside a damsel and runs left until it's far out of the view. It goes off there, out of sight: the screen shakes. He walks back, and the floor where the bomb lay is gone, so he drops into the hole. ([video](https://spelunky.ai/wiki/media/clips/quirks/bomb-off-screen/clip.mp4))

## Why

An explosion breaks a block when it touches it, but only if this test passes:

```gml objects/oExplosion/collision_oSolid.gml:1-2
if (isLevel("rTutorial") or (x > view_xview[0]-16 and x < view_xview[0] + view_wview[0]+16 and
     y > view_yview[0]-16 and y < view_yview[0] + view_hview[0]+16))
```

[`objects/oExplosion/collision_oSolid.gml:1-2`](https://spelunky.ai/wiki/source/objects/oExplosion/collision_oSolid#L1-L2), from `spelunky.gmk`, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC ([Spelunky User License v1.1b](https://spelunky.ai/LICENSE.txt)).

The second half asks whether the explosion is within 16 pixels of the screen, as the [thrown items'](https://spelunky.ai/wiki/throwing)
step does ([Items freeze off screen](https://spelunky.ai/wiki/items-freeze-off-screen)). The first half reads as "or this is the Tutorial", but `isLevel` takes
no argument (GameMaker passes it one anyway, and nothing reads it). It asks whether the room is a level at all,
the Tutorial, any level of the game, [Olmec](https://spelunky.ai/wiki/olmec)'s lair or a [custom level](https://spelunky.ai/wiki/level-editor)[^2]. So on a level the test always passes, and the explosion breaks every block
it touches but the unbreakable ones, the level's border and the blocks under its doors[^3]. (The
only other room with explosions, the high scores room's [Sun Room](https://spelunky.ai/wiki/sun-room), passes the screen test anyway: its screen
doesn't move, and the room is barely taller than it[^4].) Whether `isRoom`, which does take a room's name, was meant is a guess: the screen's own
code uses `isRoom("rTutorial")` to keep the Tutorial's messages white[^5].
The same mix-up is in the level's copy of that code, where it does nothing that shows: the screen's yellow
covers it.

The blast still only reaches what the game is running. Every step, the level pauses (deactivates) everything more
than 96 pixels past the screen, keeping the explosion itself going, and a paused bomb's fuse doesn't burn[^6]. So a bomb goes off out of sight only within that margin, or where
the level keeps more running: further to the right of and below the player, where a mistake in the same code
reaches, and around a rolling [Boulder](https://spelunky.ai/wiki/boulder) or [Olmec](https://spelunky.ai/wiki/olmec). The blocks it breaks are the ones still running.

## Reproducing it

Drop a bomb and run, so that it's out of sight but not too far when it goes off, then go back: the blocks around
it are gone. It happens on every level, with any bomb left behind, and with a dead [Fire Frog](https://spelunky.ai/wiki/fire-frog)'s.
The clip's replay drops the bomb on level 13 (frame 790) and runs left. It goes off on 909 at x 497, with the
screen's left edge at 103, 74 pixels past its right edge, and breaks six temple blocks and a stone block, the
floor it lay on among them (909-917). The player walks back and drops into the hole (1028-1037)[^7]. In seed 9's City of Gold run, a Fire Frog
the player kills on level 7 leaves its bomb behind him, and it breaks two blocks 93 pixels past the screen's left
edge (3095-3097)[^8].

## In the port

The spelunky.ai port reproduces it exactly: it's in docs/quirks.md's list of the 1.1 source's bugs[^3], and the oracle's fingerprint of the clip's replay pins the blocks the explosion breaks. No
option turns it off.

## FAQ

### Does a bomb that explodes off screen break blocks in Spelunky Classic?

Yes. An explosion breaks every block it touches, but the level's unbreakable ones, wherever it is. The code has a test meant to limit that to the screen, outside the Tutorial, but the test is always passed.

### Why does a bomb sometimes not go off while I'm far away?

The game pauses most things more than 96 pixels past the edge of the screen (more to the right of and below the player), a bomb's fuse with them. A bomb out there waits until the player comes back near it, then burns on. One closer to the screen goes off, and its blast breaks blocks.

### What is isLevel("rTutorial")?

The test in the explosion's code that was meant to ask "is this the Tutorial?". The function it calls, isLevel, takes no argument and asks "is this a level?", which is true on every level of the game.

## See also

- **Related:** [Bomb](https://spelunky.ai/wiki/bomb), [Tutorial](https://spelunky.ai/wiki/tutorial), [Items freeze off screen](https://spelunky.ai/wiki/items-freeze-off-screen)

## References

[^1]: Clip [quirks/bomb-off-screen](https://spelunky.ai/wiki/explosions-break-blocks-off-screen#clip-quirks-bomb-off-screen)

[^2]: [`scripts/isLevel.gml:7`](https://spelunky.ai/wiki/source/scripts/isLevel#L7)

[^3]: [“An explosion breaks blocks off the screen too.”](https://github.com/851-labs/spelunky/blob/33760636fec777769ce826d506b800fba381da4e/docs/quirks.md?plain=1#L72), [docs/quirks.md §1](https://github.com/851-labs/spelunky/blob/33760636fec777769ce826d506b800fba381da4e/docs/quirks.md#1-bugs-and-leftovers-in-the-11-source)

[^4]: [`objects/oSunRoom/alarm_0.gml:31-36`](https://spelunky.ai/wiki/source/objects/oSunRoom/alarm_0#L31-L36)

[^5]: [`objects/oScreen/step_begin.gml:252`](https://spelunky.ai/wiki/source/objects/oScreen/step_begin#L252)

[^6]: [`objects/oLevel/step.gml:64-100`](https://spelunky.ai/wiki/source/objects/oLevel/step#L64-L100)

[^7]: Replay [`fidelity/replays/temple-seed-2-bomb-off-screen.txt`](https://github.com/851-labs/spelunky/blob/33760636fec777769ce826d506b800fba381da4e/fidelity/replays/temple-seed-2-bomb-off-screen.txt), which the clip [A bomb breaks the floor off the screen](https://spelunky.ai/wiki/explosions-break-blocks-off-screen#clip-quirks-bomb-off-screen) plays

[^8]: Replay [`fidelity/replays/city-of-gold-seed-9.txt`](https://github.com/851-labs/spelunky/blob/33760636fec777769ce826d506b800fba381da4e/fidelity/replays/city-of-gold-seed-9.txt)

### Source code

- [`objects/oExplosion/collision_oSolid.gml`](https://spelunky.ai/wiki/source/objects/oExplosion/collision_oSolid)
- [`scripts/isLevel.gml`](https://spelunky.ai/wiki/source/scripts/isLevel)
- [`objects/oLevel/step.gml`](https://spelunky.ai/wiki/source/objects/oLevel/step)
