Snake
Verified against the spelunky.ai port v0.1.7 on .
The Snake is a monster in Spelunky Classic, found mostly in the Mines, that slithers back and forth along the ground and bites for 1 heart on contact.
Level generation can put a Snake on top of almost any block in the Mines, and a Snake pit holds several more; elsewhere, Snakes come out of Jars. A Snake doesn't chase the player: it patrols the ground it's on and bites him on contact. With 1 hit point, it dies to any damage, whether from the Whip, a stomp or a thrown Rock.
Behaviour
#A Snake walks along the ground at 1 pixel per step (30 per second). It turns around when it walks into a wall or reaches the edge of a ledge, so it never walks off one [5]. Where it has a wall or a drop on both sides, as on a platform one block wide, it stands still [6].
While walking, it has a 1 in 100 chance each step of stopping for 20–50 steps (0.67–1.67 seconds). When the pause ends, it sets off in a random direction [7], as a new Snake does on its first step [8]. Its animation runs at half speed while it stands still [9].
A Snake only acts while it's on screen or less than 4 pixels off it: its whole step event is inside that check [10].
Damage
#When the player touches a Snake without stomping it, he loses 1 heart, is knocked away from it, and blinks, invincible, for 30 steps (1 second), so the Snake can't bite again straight away [11]. This is the touch code the Snake inherits from the parent object most monsters share; the Snake has no attack of its own (Trivia). The clip shows a bite taking the player from four hearts to three.
Defeating
#A Snake has 1 hit point, so any damage kills it [12]:
| Way | Damage | |
|---|---|---|
| Whip | 1 hit point | [13] |
| Machete | 2 hit points | [13] |
| Stomp (landing on it) | 1, plus 1 for every 16 steps of falling; three times that with Spike Shoes | [14] |
| A thrown item moving faster than 2 pixels per step, such as a Rock | 1 | [15] |
| A Shotgun or Pistol bullet | 4 hit points | [16] |
| A Bomb's explosion | 30 hit points | [17] |
| A Spear Trap's spears | 2 | [18] |
| Falling onto Spikes | Kills it | [19] |
| Standing in Lava | Kills it | [20] |
| Lava over its head | Removes it | [21] |
| Ending up inside solid ground | Kills it | [22] |
The first clip shows a stomp: the player drops onto a Snake from the ledge above and it dies as he lands. The second shows a thrown Rock killing one from a ledge.
Snakes killed count toward the player's kills, and the screen between levels draws a Snake icon for each [23] [24]. A Snake that Spikes, Lava or a Spear Trap killed doesn't count, which the code explains as "sometimes it's not the player's fault!" [25] [26] [27] [28], and one that lava covers is removed without dying, so it isn't counted either [21].
Locations
#Level generation makes Snakes only in the Mines, levels 1–4 [29]:
- On the ground. Each solid block with open space above it has a 1 in 60 chance of a Snake on top, except in the starting room and in shops [30] [31].
- In a Snake pit. A Mines level may have one snake pit, a shaft of rooms off the main path, with a 1 in 8 chance for each place one fits [32] [33]. Each snake tile in its middle rooms holds a Snake with a 1 in 10 chance, and its bottom room is built with five Snakes and two Big Rubies [34] [35]. Such a level opens with the message "I HEAR SNAKES... I HATE SNAKES!", after "I CAN'T SEE A THING!" on a dark level [36] [37].
Snakes also appear wherever these are:
- Jars. A broken Jar makes a Snake with a 1 in 12 chance once its rolls for gold, gems and a Spider have all failed [38] [39].
- Olmec's yellow balls, which turn into a Bat, Spider, Snake, Frog or Fire Frog when they hit the ground [40].
- The Tutorial, which has one [41].
- Custom levels, as the level editor's tile
n[42].
Tips
#- A Snake never walks off a ledge, so one on a platform stays on it, and one on a platform one block wide never moves.
- After a bite, the player is invincible for 1 second, during which touching the Snake again costs nothing.
- A Snake off screen doesn't move, so one is still where it was when it left the screen.
Trivia
#-
The Snake's code defines an attack state, but nothing in it ever enters that state, and its branch holds only a question mark:
else if (status == ATTACK) { // ? }objects/oSnake/step.gml:73-76, fromspelunky.gmk, Spelunky Classic 1.1's source, © 2008, 2009 Derek Yu and Mossmouth, LLC (Spelunky User License v1.1b). -
A commented-out block at the end of its step event would switch to a right-facing sprite,
sSnakeWalkR, which the game doesn't have. The Snake uses its left-facing sprite both ways, mirrored when it faces right [43] [44].
FAQ
#- How much damage does a Snake do in Spelunky Classic?
1 heart per bite. Touching a Snake costs the player 1 heart, knocks him back and makes him invincible for 30 steps (1 second), so it can't bite again at once.
- How do you kill a Snake in Spelunky Classic?
Hit it once with anything. A Snake has 1 hit point, so a Whip hit, a stomp, a thrown Rock, a bullet or a Bomb kills it.
- Where do Snakes appear in Spelunky Classic?
Mostly in the Mines (levels 1–4), the only area whose level generation makes them: on the ground and in snake pits. Anywhere else, one can come out of a broken Jar or one of Olmec's yellow balls. The Tutorial has one.
- Is the Snake poisonous in Spelunky Classic?
No. Spelunky Classic has no poison: a Snake's bite takes 1 heart and nothing else.
- Does the Snake chase the player?
No. Its movement never looks at where the player is: it walks along the ground, turns at walls and ledges, and stops at random.
See also
#References
#objects/oSnake/create.gml:10objects/oEnemy/collision_oCharacter.gml:25objects/oSnake/step.gml:63objects/oSnake/step.gml:39-72objects/oSnake/step.gml:41-54objects/oSnake/step.gml:56-62objects/oSnake/step.gml:30-37objects/oSnake/create.gml:18-26objects/oSnake/step.gml:81-87objects/oSnake/step.gml:3-4objects/oEnemy/collision_oCharacter.gml:14-25objects/oSnake/step.gml:16-26objects/oEnemy/collision_oWhip.gml:1objects/oEnemy/collision_oCharacter.gml:6-10objects/oItem/step.gml:256-344objects/oBullet/collision_oEnemy.gml:16objects/oExplosion/collision_oEnemy.gml:14objects/oEnemy/step.gml:76-106objects/oEnemy/step.gml:108-128objects/oEnemy/step.gml:65-74objects/oEnemy/step.gml:63objects/oSnake/step.gml:11-14objects/oSnake/step.gml:19-24objects/oTransition/alarm_0.gml:131-136objects/oEnemy/create.gml:35objects/oEnemy/step.gml:68objects/oEnemy/step.gml:101objects/oEnemy/step.gml:120scripts/scrInitLevel.gml:24-29scripts/scrEntityGen.gml:30-45scripts/scrEntityGen.gml:67-69scripts/scrLevelGen.gml:138-185scripts/scrClearGlobals.gml:55scripts/scrRoomGen.gml:205-216scripts/scrRoomGen.gml:462-473objects/oPlayer1/alarm_0.gml:5-26objects/oPlayer1/alarm_1.gml:5-10objects/oJar/destroy.gml:17-28objects/oJar/collision_oWhip.gml:9-15objects/oYellowBall/step.gml:4-19- Room
rTutorial, as the room editor placed it scripts/scrCreateTileObj.gml:131-134objects/oSnake/step.gml:88-96objects/oEnemy/draw.gml:1-2objects/oEnemy/step.gml:63-74
Source code
objects/oSnake/create.gmlobjects/oSnake/step.gmlobjects/oEnemy/create.gmlobjects/oEnemy/step.gmlobjects/oEnemy/collision_oCharacter.gmlobjects/oEnemy/collision_oWhip.gmlscripts/scrEntityGen.gmlscripts/scrLevelGen.gmlscripts/scrRoomGen.gmlobjects/oJar/destroy.gmlobjects/oYellowBall/step.gml
What links here
#No other page links here yet.