The Smash Trap's random throw
Verified against the spelunky.ai port v0.1.11 on .
The Smash Trap's random throw is a quirk of Spelunky Classic in which a Smash Trap that has never slid throws the player it hits down one time in four.
A Smash Trap's hit takes 10 hearts and throws the player. Which way is decided by the trap: across, toward it, and up, or down if it's sliding down. A trap that has never slid has no way it's sliding, only the one it picked at random when it was made, so its hit throws the player down one time in four.
What happens
#The player drops into a gap beside a Smash Trap that hasn't moved yet and brushes its corner from above its row. The hit throws him down, not up, because the trap was made facing down at random; he falls into its row, and it slides into him [1].
Why
#When the player touches a Smash Trap, his step takes the nearest one, not always the one he touches, and throws him by it:
obj = instance_nearest(x, y, oSmashTrap);
global.plife -= 10;
if (obj.x+8 < x) xVel = -rand(4,6);
else xVel = rand(4,6);
yVel = -6;
if (obj)
{
if (obj.dir == 1) yVel = 4;
}objects/oPlayer1/step.gml:1653-1661, from spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b).xVel is negative when the trap's middle is left of him, so it throws him toward the trap, from either side.
The trap is solid, so he stays against it, to be hit again on the next step [2]. yVel is -6, or
4 if the trap's dir is 1, down. A slide sets dir to the way it goes
[3], but before its first slide it's what the create event picked:
dir = rand(0,3);objects/oSmashTrap/create.gml:25, from spelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b).So a trap that has never slid throws him down one time in four. Touching one without setting it off takes coming at it from outside its row and column, as inside them it slides at him first [2].
Reproducing it
#Drop past a Smash Trap that hasn't moved, brushing its corner from above its row. The replay of the clip's staged
scene, a custom level with seed 1, has a trap whose create event makes its dir 1. The player drops into the gap
beside it and touches its corner from above its row, before it has moved: the hit throws him down, with a yVel
of 4, and toward it. Thrown down into its row, he sets it off, and it slides into him
[4]. A trap that slides at the player throws him toward
it too, from his right, and goes on over him [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 [2], and the oracle's fingerprints of both replays pin the throws. No option turns it off.
FAQ
#- Why does a Smash Trap throw the player into it?
Its hit throws the player toward the trap's middle, from either side. The trap is solid, so he isn't knocked clear: he stays against it, to be hit again, and a sliding trap usually goes on over him and crushes him.
- Why did a Smash Trap throw the player down?
Its hit throws him down if the trap is sliding down. A trap that has never slid has a direction it picked at random when it was made, so its hit throws him down one time in four, whichever side he touches it from.
- Does a lit Smash Trap throw the player too?
No. On a dark level the trap is another kind of object, which the player's check for a Smash Trap doesn't see, so its touch neither hurts nor throws him. It kills only by sliding on into him.
See also
#- Related
References
#- Clip quirks/smash-trap-random-throw
- Quirk 1 (docs/quirks.md)
objects/oSmashTrap/step.gml:4-35- Replay
fidelity/replays/trap-smash-random-throw.txt - Replay
fidelity/replays/trap-smash-crush.txt