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.

# The Udjat Eye's key sealed in rock

From the spelunky.ai wiki: <https://spelunky.ai/wiki/udjat-key-sealed>. Verified against the spelunky.ai port [v0.1.12](https://github.com/851-labs/spelunky/releases/tag/v0.1.12) on 28 October 2026.

This page describes a secret.

The Udjat Eye's key sealed in rock is a quirk of Spelunky Classic in which the locked chest's key can lie in a pocket of rock that no way leads into.

| Quirk     |                                                                                                                                                                                                                 |
| --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Status    | GML + Oracle                                                                                                                                                                                                    |
| Where     | [`scripts/scrEntityGen.gml:108-143`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L108-L143)                                                                                                            |
| Pinned by | `fidelity/replays/item-seed-35-udjat-eye-sealed-key.txt`                                                                                                                                                        |
| Row       | [docs/quirks.md §1, Bugs and leftovers in the 1.1 source](https://github.com/851-labs/spelunky/blob/main/docs/quirks.md#1-bugs-and-leftovers-in-the-11-source): “The locked chest's key can be sealed in rock.” |

The [Udjat Eye](https://spelunky.ai/wiki/udjat-eye) comes from a locked chest on one of levels 2 to 4, and its key is one of that level's
treasures, turned into the key. Nothing checks that the player can reach the treasure it picks, so the key can
lie in a pocket of rock that no way leads into, sometimes with the chest, and the rock has to be broken open.

## What happens

Bombs have opened a pocket of rock that holds a locked chest and its key. An [Arrow Trap](https://spelunky.ai/wiki/arrow-trap) fires over
the player as he drops in; he picks up the key, crawls under the low rock to the chest, opens it and puts on the
Udjat Eye[^1].

**Clip: Key sealed in rock.** Bombs have opened a pocket of rock holding a locked chest and its key. An arrow trap fires over the player as he drops in; he picks up the key, crawls under the low rock to the chest, opens it and puts on the Udjat Eye. ([video](https://spelunky.ai/wiki/media/clips/udjat-eye/sealed-key/clip.mp4))

## Why

The level that makes the locked chest, level 2 one time in 3, level 3 one time in 2, or else level 4, until one
is made[^2], turns one of its treasures into the key, after
the treasure is placed. Each treasure that isn't inside a block takes a roll of 1 in 8, for up to seven passes, and
if none wins, the first one takes it:

```gml scripts/scrEntityGen.gml:111-126
        n = 1;
        while (n < 8 and global.Key == false)
        {
            with oTreasure
            {
                if (rand(1,8) <= 1 and not collision_point(x, y, oSolid, 0, 0) and global.Key == false)
                {
                    if (type == "Gold Bars") instance_create(x, y+4, oKey);
                    else instance_create(x, y, oKey);
                    global.Key = true;
                    instance_destroy();
                    break;
                }
            }
            n += 1;
        }
```

[`scripts/scrEntityGen.gml:111-126`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L111-L126), 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 only test is that the treasure isn't inside a block. A treasure can be anywhere in the level, so the key can
sit in a pocket that no way leads into. The chest goes in a nook in the rock, or beside the exit[^3], so it's sometimes in the same pocket. The pocket's rock is
ordinary, so an explosion or the Mattock's hit breaks it open[^4]. The chest opens only to the key
the player holds[^5], so the key has to be carried to it.

## Reproducing it

Look for the locked chest and its key on level 2, 3 or 4, and carry the key to the chest. Some levels seal the
key in a pocket, which a bomb dropped or thrown at its wall opens. The replay of the clip makes level 2, frame
1456, with the chest and the key sealed together in a pocket beside the shaft that drops to the exit. A bomb
thrown down the shaft blows out five bricks at its foot (2053), and one put down against its wall blows out six
more (2221), opening the pocket. The player drops in, picks up the key (2308) and crawls it to the chest, which
opens and drops the Udjat Eye (2349). He picks the Eye up and it goes on (2364)[^6].

## 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[^4], and the oracle's fingerprint of the replay pins the sealed pocket, the bombs and the opened
chest. No option turns it off.

## FAQ

### Why can't I reach the key to the locked chest in Spelunky Classic?

It can be sealed in rock. The key is one of the level's treasures, picked at random from those not inside a block, and a treasure can lie in a pocket of rock that nothing leads into, which has to be broken open, with a [Bomb](https://spelunky.ai/wiki/bomb) or the [Mattock](https://spelunky.ai/wiki/mattock).

### Can the locked chest be sealed in rock too?

Yes, sometimes in the same pocket as the key. The key then has to be carried to the chest inside it, as the chest only opens to the key in the player's hands.

### What if the key is sealed and I have no bombs?

The Mattock breaks the rock too. And the game makes no other chest: once a level has made the key, no later level makes another, so a key left sealed is the [Udjat Eye](https://spelunky.ai/wiki/udjat-eye) lost for that game.

## See also

- **Related:** [Udjat Eye](https://spelunky.ai/wiki/udjat-eye), [Bomb](https://spelunky.ai/wiki/bomb), [Mattock](https://spelunky.ai/wiki/mattock)

## References

[^1]: Clip udjat-eye/sealed-key

[^2]: [`scripts/scrInitLevel.gml:178-184`](https://spelunky.ai/wiki/source/scripts/scrInitLevel#L178-L184)

[^3]: [`scripts/scrTreasureGen.gml:47-64`](https://spelunky.ai/wiki/source/scripts/scrTreasureGen#L47-L64)

[^4]: Quirk 1 (docs/quirks.md)

[^5]: [`objects/oLockedChest/collision_oKey.gml:1-21`](https://spelunky.ai/wiki/source/objects/oLockedChest/collision_oKey#L1-L21)

[^6]: Replay `fidelity/replays/item-seed-35-udjat-eye-sealed-key.txt`

### Source code

- [`scripts/scrEntityGen.gml`](https://spelunky.ai/wiki/source/scripts/scrEntityGen)
- [`scripts/scrInitLevel.gml`](https://spelunky.ai/wiki/source/scripts/scrInitLevel)
- [`scripts/scrTreasureGen.gml`](https://spelunky.ai/wiki/source/scripts/scrTreasureGen)
- [`objects/oLockedChest/collision_oKey.gml`](https://spelunky.ai/wiki/source/objects/oLockedChest/collision_oKey)
