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 City of Gold's door anywhere

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

The City of Gold's door anywhere is a quirk of Spelunky Classic in which level 14's door to the City of Gold can be sealed in rock, or stand on Kali's altar.

| Quirk     |                                                                                                                                                                                                        |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Status    | GML + Oracle                                                                                                                                                                                           |
| Where     | [`scripts/scrEntityGen.gml:385-410`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L385-L410)                                                                                                   |
| Pinned by | `fidelity/replays/temple-seed-1-gold-door-on-altar.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 gold door can be sealed in rock.” |

Level 14 always has the [City of Gold](https://spelunky.ai/wiki/city-of-gold)'s door, and the roll that places it asks for one thing of
the block under it: open space above. It doesn't ask whether the player can reach that space, so the door can be
sealed in rock that has to be broken open, and it doesn't skip [Kali's altar](https://spelunky.ai/wiki/kalis-altar), so the door can
stand on one, and make that half of the altar as hard to break as the door's block always is.

## What happens

Level 14 loads with the gold door on the left half of Kali's altar, at the top of the level. The player walks
over and stands on the altar's other half, beside the door[^1].

**Clip: The City of Gold's door on Kali's altar.** Level 14 loads with the City of Gold's door standing on the left half of Kali's altar, where level generation put it: the door's roll doesn't skip the altar. The player walks over and stands on the altar's other half, beside the door. ([video](https://spelunky.ai/wiki/media/clips/quirks/gold-door-on-altar/clip.mp4))

## Why

`scrEntityGen` goes over the [Temple](https://spelunky.ai/wiki/temple)'s blocks one by one, and on level 14, until the door is made, each
block outside a shop with open space above it, but for the top few rows, takes the door's roll:

```gml scripts/scrEntityGen.gml:400-409
        if (y > 32 and not collision_point(x, y-16, oSolid, 0, 0) and global.genGoldEntrance and not global.madeGoldEntrance)
        {
            if (rand(1,global.goldChance) == 1)
            {
                instance_create(x, y-16, oGoldDoor);
                invincible = true;
                global.madeGoldEntrance = true;
            }
            else global.goldChance -= 1;
        }
```

[`scripts/scrEntityGen.gml:400-409`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L400-L409), 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)).

`goldChance` starts each game at 160[^2], and if no block wins, the
door goes on the first block with open space above it[^3]. Either
way, one free tile is all the door needs: the space above the block can be a pocket in the rock, with no way into
it. The Spear Traps' roll, the `else` beside it, skips trees and the altar (`type != "Altar"`)[^4]; the door's doesn't, and the block under it, an altar half
included, gets `invincible = true`, which explosions and the Mattock spare[^5][^6]. But the other half's destroy event destroys every
altar half, `with oSacAltarLeft`, which takes in its child, the right half[^7], and the door's half still crumbles when the floor under it
goes, once it's within the view[^8][^9].

## Reproducing it

Reach level 14 and look for the door. Most levels have it in the open; some seal it in a pocket of rock, which
a bomb or the Mattock opens from above or beside. Waiting at level 13's exit before taking it rerolls level 14, and a sweep of
3,757 level 14s rerolled that way put the door on the altar in 15, 1 in 77 of the 1,156 with an altar[^9]. The replay of the clip rerolls level 14 with seed 1: the door stands on the altar's left
half, which is `invincible`, and the player stands on the right half beside it[^10]. With seed 9 another level 14 puts the
door in a 20-tile pocket under the floor of the room above, and the run blows its way in with two bombs and
carries the [Sceptre](https://spelunky.ai/wiki/sceptre) into the door, which opens[^11]. [Reaching the City of Gold](https://spelunky.ai/wiki/city-of-gold-route) walks the rest of
the way in.

## 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[^9], and the oracle's fingerprints of the replays pin the door's place, the altar's `invincible`
and the sealed door's pocket. No option turns it off.

## FAQ

### Why can't I find the gold door on level 14?

It can be sealed in rock. The roll that places it only asks for a block with open space above it, anywhere in the level, so the door can stand in a pocket that no way leads into, which a [Bomb](https://spelunky.ai/wiki/bomb) or the [Mattock](https://spelunky.ai/wiki/mattock) has to break open.

### Can the gold door stand on Kali's altar?

Yes, on about one level 14 in 77 that has an altar. The Spear Traps' roll beside the door's skips the altar, but the door's doesn't, so either half of [Kali's altar](https://spelunky.ai/wiki/kalis-altar) can be the block under it.

### Can the altar under the gold door be destroyed?

The half under the door survives explosions and the Mattock, as every block under the door does. But the other half's destruction still takes both, and the door's half still crumbles when the floor under it goes.

## See also

- **Related:** [City of Gold](https://spelunky.ai/wiki/city-of-gold), [Kali's Altar](https://spelunky.ai/wiki/kalis-altar), [The Temple](https://spelunky.ai/wiki/temple), [Reaching the City of Gold](https://spelunky.ai/wiki/city-of-gold-route)

## References

[^1]: Clip quirks/gold-door-on-altar

[^2]: [`scripts/scrClearGlobals.gml:80`](https://spelunky.ai/wiki/source/scripts/scrClearGlobals#L80)

[^3]: [`scripts/scrEntityGen.gml:482-495`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L482-L495)

[^4]: [`scripts/scrEntityGen.gml:410-418`](https://spelunky.ai/wiki/source/scripts/scrEntityGen#L410-L418)

[^5]: [`objects/oExplosion/collision_oSolid.gml:14`](https://spelunky.ai/wiki/source/objects/oExplosion/collision_oSolid#L14)

[^6]: [`objects/oMattockHit/other_animation_end.gml:1-22`](https://spelunky.ai/wiki/source/objects/oMattockHit/other_animation_end#L1-L22)

[^7]: [`objects/oSacAltarLeft/destroy.gml:62-66`](https://spelunky.ai/wiki/source/objects/oSacAltarLeft/destroy#L62-L66)

[^8]: [`objects/oSacAltarLeft/step.gml:1-5`](https://spelunky.ai/wiki/source/objects/oSacAltarLeft/step#L1-L5)

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

[^10]: Replay `fidelity/replays/temple-seed-1-gold-door-on-altar.txt`

[^11]: Replay `fidelity/replays/city-of-gold-seed-9-sealed-door.txt`

### Source code

- [`scripts/scrEntityGen.gml`](https://spelunky.ai/wiki/source/scripts/scrEntityGen)
- [`scripts/scrClearGlobals.gml`](https://spelunky.ai/wiki/source/scripts/scrClearGlobals)
- [`objects/oSacAltarLeft/destroy.gml`](https://spelunky.ai/wiki/source/objects/oSacAltarLeft/destroy)
- [`objects/oSacAltarLeft/step.gml`](https://spelunky.ai/wiki/source/objects/oSacAltarLeft/step)
- [`objects/oExplosion/collision_oSolid.gml`](https://spelunky.ai/wiki/source/objects/oExplosion/collision_oSolid)
- [`objects/oMattockHit/other_animation_end.gml`](https://spelunky.ai/wiki/source/objects/oMattockHit/other_animation_end)
