SpelunkyFan wiki

Unofficial fan wiki. Spelunky is © 2008, 2009 Derek Yu and Mossmouth, LLC.

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

#
Snake bite. A snake slithers up to the player and bites him, taking a heart.

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]:

WayDamage
Whip1 hit point[13]
Machete2 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 Rock1[15]
A Shotgun or Pistol bullet4 hit points[16]
A Bomb's explosion30 hit points[17]
A Spear Trap's spears2[18]
Falling onto SpikesKills it[19]
Standing in LavaKills it[20]
Lava over its headRemoves it[21]
Ending up inside solid groundKills 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.

Snake stomp. The player drops onto a snake from the ledge above and kills it by landing on it.
Rock thrown at a snake. The player throws a rock down at a snake from a ledge: a thrown item moving fast enough kills the enemy it hits.

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, from spelunky.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

#
Damaged by

References

#
  1. objects/oSnake/create.gml:10
  2. objects/oEnemy/collision_oCharacter.gml:25
  3. objects/oSnake/step.gml:63
  4. objects/oSnake/step.gml:39-72
  5. objects/oSnake/step.gml:41-54
  6. objects/oSnake/step.gml:56-62
  7. objects/oSnake/step.gml:30-37
  8. objects/oSnake/create.gml:18-26
  9. objects/oSnake/step.gml:81-87
  10. objects/oSnake/step.gml:3-4
  11. objects/oEnemy/collision_oCharacter.gml:14-25
  12. objects/oSnake/step.gml:16-26
  13. objects/oEnemy/collision_oWhip.gml:1
  14. objects/oEnemy/collision_oCharacter.gml:6-10
  15. objects/oItem/step.gml:256-344
  16. objects/oBullet/collision_oEnemy.gml:16
  17. objects/oExplosion/collision_oEnemy.gml:14
  18. objects/oEnemy/step.gml:76-106
  19. objects/oEnemy/step.gml:108-128
  20. objects/oEnemy/step.gml:65-74
  21. objects/oEnemy/step.gml:63
  22. objects/oSnake/step.gml:11-14
  23. objects/oSnake/step.gml:19-24
  24. objects/oTransition/alarm_0.gml:131-136
  25. objects/oEnemy/create.gml:35
  26. objects/oEnemy/step.gml:68
  27. objects/oEnemy/step.gml:101
  28. objects/oEnemy/step.gml:120
  29. scripts/scrInitLevel.gml:24-29
  30. scripts/scrEntityGen.gml:30-45
  31. scripts/scrEntityGen.gml:67-69
  32. scripts/scrLevelGen.gml:138-185
  33. scripts/scrClearGlobals.gml:55
  34. scripts/scrRoomGen.gml:205-216
  35. scripts/scrRoomGen.gml:462-473
  36. objects/oPlayer1/alarm_0.gml:5-26
  37. objects/oPlayer1/alarm_1.gml:5-10
  38. objects/oJar/destroy.gml:17-28
  39. objects/oJar/collision_oWhip.gml:9-15
  40. objects/oYellowBall/step.gml:4-19
  41. Room rTutorial, as the room editor placed it
  42. scripts/scrCreateTileObj.gml:131-134
  43. objects/oSnake/step.gml:88-96
  44. objects/oEnemy/draw.gml:1-2
  45. objects/oEnemy/step.gml:63-74

Source code

  • objects/oSnake/create.gml
  • objects/oSnake/step.gml
  • objects/oEnemy/create.gml
  • objects/oEnemy/step.gml
  • objects/oEnemy/collision_oCharacter.gml
  • objects/oEnemy/collision_oWhip.gml
  • scripts/scrEntityGen.gml
  • scripts/scrLevelGen.gml
  • scripts/scrRoomGen.gml
  • objects/oJar/destroy.gml
  • objects/oYellowBall/step.gml
#