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.

# Stomping while jumping

From the spelunky.ai wiki: <https://spelunky.ai/wiki/stomping-while-jumping>.

Stomping while jumping is a quirk of Spelunky Classic in which jumping up into a monster from just below kills it as a stomp would.

| Quirk                                       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [How we know](https://spelunky.ai/wiki#how) | Read in the game's code and seen in the original game running                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Where                                       | [`objects/oEnemy/collision_oCharacter.gml:6`](https://spelunky.ai/wiki/source/objects/oEnemy/collision_oCharacter#L6)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Pinned by                                   | [`fidelity/replays/enemy-mines-seed-1-kills.txt`](https://github.com/851-labs/spelunky/blob/187c08df2d359683ed808ed14322c0bfcfaa3d7a/fidelity/replays/enemy-mines-seed-1-kills.txt)                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Row                                         | [docs/quirks.md §1, Bugs and leftovers in the 1.1 source](https://github.com/851-labs/spelunky/blob/187c08df2d359683ed808ed14322c0bfcfaa3d7a/docs/quirks.md#1-bugs-and-leftovers-in-the-11-source): [“A stomp doesn't need the player to be falling: oEnemy's collision with oCharacter (the stomp most enemies inherit) accepts JUMPING (15) as well as FALLING (16) while the player's y is above the enemy's y+8, so jumping up into a bat or a dropping spider from just below kills it as a stomp would, and bounces the player.”](https://github.com/851-labs/spelunky/blob/187c08df2d359683ed808ed14322c0bfcfaa3d7a/docs/quirks.md?plain=1#L60) |

A [stomp](https://spelunky.ai/wiki/stomping) is meant to be a landing on a monster's head. But the touch code most monsters share
doesn't ask whether the player is coming down: jumping counts as well as falling, as long as he's higher than
the monster's middle. So jumping up into a monster from just below kills it as a stomp, and he bounces off it.

## What happens

The player jumps up into a flying [Bat](https://spelunky.ai/wiki/bat) from just below it and kills it, and bounces higher[^1].

**Clip: Bat killed from below.** The player jumps up into a flying bat and kills it: the game counts touching an enemy while jumping as a stomp, from below too. ([video](https://spelunky.ai/wiki/media/clips/bat/jump-kill/clip.mp4))

## Why

When a monster that inherits `oEnemy`'s touch code touches the player within 12 pixels of its middle across,
the first test is the stomp's. It accepts the player's `JUMPING` state (15) as well as `FALLING` (16), and only asks
that his `y` be above the monster's `y+8`:

```gml objects/oEnemy/collision_oCharacter.gml:6-12
else if (not other.dead and (other.state == 15 or other.state == 16) and other.y < y+8 and not other.swimming)
{
    other.yVel = -6 - 0.2 * other.yVel;
    if (global.hasSpikeShoes) { hp -= (3 * (floor(other.fallTimer/16)+1)); scrCreateBlood(other.x, other.y+8, 1); }
    else hp -= (1 * (floor(other.fallTimer/16)+1));
    other.fallTimer = 0;
    playSound(global.sndHit);
```

[`objects/oEnemy/collision_oCharacter.gml:6-12`](https://spelunky.ai/wiki/source/objects/oEnemy/collision_oCharacter#L6-L12), 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)).

A player rising into a monster from just below is jumping, so it's a stomp: the monster loses a hit point (three
with [Spike Shoes](https://spelunky.ai/wiki/spike-shoes)), and the player is bounced up, `yVel` -6 less a fifth of what it was (after his
own step's gravity, which comes first). A Bat has
1 hit point, and its step kills it once they're gone[^2][^3].

## Reproducing it

Jump up into a Bat, or a [Spider](https://spelunky.ai/wiki/spider) dropping from the ceiling, from just below, so that the player's middle
is above the monster's when they touch. It happens in normal play. The replay of the clip jumps on frame 1073
and, still rising, hits a Bat: on 1076 the stomp's bounce, after his step's gravity, takes the player's `yVel`
from -3.4 to -5.4, and the Bat dies on 1077[^4].

## 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 replay pins the jump, the bounce and the kill. No option
turns it off.

## FAQ

### Can you stomp a Bat by jumping into it in Spelunky Classic?

Yes. A stomp only needs the player to be jumping or falling with his middle above the monster's, so jumping up into a [Bat](https://spelunky.ai/wiki/bat) from just below kills it, and he bounces as if he'd landed on it.

### Which monsters can be stomped from below?

Nearly all. The touch code most monsters share, the Bat's and a dropping [Spider](https://spelunky.ai/wiki/spider)'s among them, takes a jumping player, and so do most of the monsters' own, the Caveman's and the Hawkman's included, some only closer to the monster's top. A Yeti, the Yeti King or a Shopkeeper stomped on the way up takes no hit points from it, but is stunned ([Stomps that take nothing on the way up](https://spelunky.ai/wiki/yeti-stomp-rising)).

### Does jumping into a monster from below hurt the player?

Not when it counts as a stomp. The touch code tests for a stomp before it tests for hurting him, so a player who's higher than the monster's middle takes nothing, and bounces off it.

## See also

- **Related:** [Stomping](https://spelunky.ai/wiki/stomping), [Bat](https://spelunky.ai/wiki/bat), [Spider](https://spelunky.ai/wiki/spider)

## References

[^1]: Clip [bat/jump-kill](https://spelunky.ai/wiki/stomping-while-jumping#clip-bat-jump-kill)

[^2]: [`objects/oBat/step.gml:8`](https://spelunky.ai/wiki/source/objects/oBat/step#L8)

[^3]: [“A stomp doesn't need the player to be falling: oEnemy's collision with oCharacter (the stomp most enemies inherit) accepts JUMPING (15) as well as FALLING (16) while the player's y is above the enemy's y+8, so jumping up into a bat or a dropping spider from just below kills it as a stomp would, and bounces the player.”](https://github.com/851-labs/spelunky/blob/187c08df2d359683ed808ed14322c0bfcfaa3d7a/docs/quirks.md?plain=1#L60), [docs/quirks.md §1](https://github.com/851-labs/spelunky/blob/187c08df2d359683ed808ed14322c0bfcfaa3d7a/docs/quirks.md#1-bugs-and-leftovers-in-the-11-source)

[^4]: Replay [`fidelity/replays/enemy-mines-seed-1-kills.txt`](https://github.com/851-labs/spelunky/blob/187c08df2d359683ed808ed14322c0bfcfaa3d7a/fidelity/replays/enemy-mines-seed-1-kills.txt), which the clip [Bat killed from below](https://spelunky.ai/wiki/stomping-while-jumping#clip-bat-jump-kill) plays

### Source code

- [`objects/oEnemy/collision_oCharacter.gml`](https://spelunky.ai/wiki/source/objects/oEnemy/collision_oCharacter)
- [`objects/oBat/step.gml`](https://spelunky.ai/wiki/source/objects/oBat/step)
