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.

# Mattock breaking the wrong block

From the spelunky.ai wiki: <https://spelunky.ai/wiki/mattock-wrong-block>. Verified against the spelunky.ai port [v0.1.10](https://github.com/851-labs/spelunky/releases/tag/v0.1.10) on 28 October 2026.

Mattock breaking the wrong block is a quirk of Spelunky Classic in which the Mattock can break the block under the player or the one beyond the block ahead.

| Quirk     |                                                                                                                                                                                                                                                              |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Status    | GML + Oracle                                                                                                                                                                                                                                                 |
| Where     | `objects/oMattockHit/other_animation_end.gml:1-11`                                                                                                                                                                                                           |
| Pinned by | `fidelity/replays/weapon-mattock-wrong-block.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 Mattock's hit can break the block under the player, or the one beyond the block ahead.” |

The [Mattock](https://spelunky.ai/wiki/mattock) digs: its swing breaks a block ahead of the player, at his height or, if there's none
there, ahead of his feet. Which block it breaks isn't always the one it tested for. Depending on where he
stands, it can break the floor under him, so he drops through, or skip the block ahead and break the next.

## What happens

Facing left, the player swings a Mattock at the floor ahead of him: it breaks the block beyond that one, and
the block in front stays. He steps right and swings again: this time it breaks the block he stands on, and he
drops into the hole[^1].

**Clip: The Mattock breaks the wrong block.** Facing left, the player swings a mattock at the floor ahead of him: it breaks the block beyond that one, and the block in front stays. He steps right and swings again: this time it breaks the block he stands on, and he drops into the hole. ([video](https://spelunky.ai/wiki/media/015c74cb8645abba/clips/quirks/mattock-wrong-block/clip.mp4))

## Why

The Mattock's hit sits 16 pixels ahead of the player, at his height[^2]. When its animation ends, it tests the point at its position
for a block, then the point 9 pixels below, ahead of his feet, and breaks the block `instance_place` finds
there[^3]:

```gml objects/oMattockHit/other_animation_end.gml:1-11
hit = false;
if (collision_point(x, y, oSolid, 0, 0))
{
    obj = instance_place(x, y, oSolid);
    if (not obj.invincible) hit = true;
}
else if (collision_point(x, y+9, oSolid, 0, 0))
{
    obj = instance_place(x, y+9, oSolid);
    if (not obj.invincible) hit = true;
}
```

`objects/oMattockHit/other_animation_end.gml:1-11`, 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)).

`collision_point` tests one point, but `instance_place` tests the hit's whole sprite box there, and returns
the first block in the level's order that overlaps it. The box is 11 pixels wide, so where the player stands
it can overlap two blocks: facing right with his position at 0 to 7 pixels into a block, the block under
him as well as the one ahead; facing left at 0 to 2, the block beyond the one ahead. When that other block
comes first, it breaks instead[^4]. A custom level makes its blocks row by row from the left,
so there, facing right, half of all positions dig the player's own floor[^4].

## Reproducing it

Dig with the Mattock along a floor, facing right, standing near the left edge of a block. The replay of the
clip's staged scene, on a custom level, pins both cases: facing left, the swing breaks the block beyond the one
ahead; facing right, the block under the player, and he falls in[^5].

## 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 blocks broken. No option turns it off.

## FAQ

### Why does the Mattock dig the floor under the player in Spelunky Classic?

The [Mattock](https://spelunky.ai/wiki/mattock) tests for a block at one point ahead of the player, but breaks the first block its whole hit box overlaps, which can be the one he's standing on. He drops into the hole.

### Which block does the Mattock break?

The block ahead of the player, or ahead of his feet if there's none at his height, unless its hit box also overlaps the block under him (facing right) or the one beyond (facing left), and that block comes first in the level's list of blocks.

### Is the Mattock breaking the wrong block a bug?

It's in the 1.1 source: the test and the block it breaks are found two ways. The spelunky.ai port keeps it.

## See also

- **Related:** [Mattock](https://spelunky.ai/wiki/mattock)

## References

[^1]: Clip quirks/mattock-wrong-block

[^2]: `objects/oMattockHit/step.gml:5-14`

[^3]: `objects/oMattockHit/other_animation_end.gml:1-11`

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

[^5]: Replay `fidelity/replays/weapon-mattock-wrong-block.txt`

### Source code

- `objects/oMattockHit/other_animation_end.gml`
- `objects/oMattockHit/step.gml`
