SpelunkyFan wiki

Bat

Verified against the spelunky.ai port v0.1.8 on .

The Bat is a monster in Spelunky Classic that hangs from cave ceilings, wakes when the player passes below, and flies straight at him, biting for 1 heart.

Level generation hangs Bats under blocks in the Mines and the Jungle. Once awake, a Bat flies through the air toward the player, around walls rather than through them, and bites him on contact; when he gets far enough away, it goes back to a ceiling. With 1 hit point, it dies to any damage, including a stomp from below.

Behaviour

#
Bat swoop. A bat hanging from the ceiling wakes as the player walks below it and swoops down to bite him.

A Bat starts out hanging under a block. It wakes when the player is within 90 pixels of its middle and more than 16 pixels below its top, or when the block it hangs from is gone, unless the player is swimming or dead [7]. The clip shows one waking as the player walks beneath it and swooping down to bite him.

Awake, it flies straight toward the player while he's within 160 pixels, at 1 pixel per step (30 per second) as its code sets it [8] [9]. The game moves it in whole pixels on each axis, so flying diagonally it covers 1 pixel across and 1 up or down each step, about 1.4 in all [10]. A wall in the way turns it rather than stopping it: blocked on the player's side, it flies straight up or down toward his height, and blocked above or below, straight sideways toward him [11]. Over water, it doesn't fly downward [12].

When the player is farther away than that, or swimming, or dead, the Bat flies straight up until it touches a ceiling and hangs from it again [13] [14]. Like most monsters, it only acts while it's on screen or just off it [15].

Damage

#

When the player touches a Bat without stomping it, he loses 1 heart, is knocked away from it, and blinks, invincible, for 30 steps (1 second) [16]. This is the touch code the Bat inherits from the parent object most monsters share; it has no attack of its own.

Defeating

#

A Bat has 1 hit point, so any damage kills it [17]:

WayDamage
Whip1 hit point[18]
Machete2 hit points[18]
Stomp (landing on it, or jumping up into it)1, plus 1 for every 16 steps of falling; three times that with Spike Shoes[19]
A thrown item moving faster than 2 pixels per step, such as a Rock1[20]
A Shotgun or Pistol bullet4 hit points[21]
A Bomb's explosion30 hit points[22]
Ending up inside solid groundKills it[23]
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.

The clip shows the player jumping up into a flying Bat and killing it. The touch code counts a touch as a stomp while the player is jumping as well as falling, as long as he's higher than the monster's middle, so a Bat can be stomped from below [24] [25].

The Bat's own step event replaces the one most monsters share, which is where Spikes, Lava and Spear Traps hurt them, so none of those harm a Bat [26].

Bats killed count toward the player's kills, and the screen between levels draws a Bat icon for each [27] [28].

Locations

#

Level generation makes Bats in two areas, each hanging under a block that has two blocks of open space below it (with no water there, and in the Mines no monster right under it), outside the starting room and shops and above the level's bottom 64 pixels:

  • The Mines: a 1 in 60 chance for each such block, once the rolls before it have failed: a Giant Spider and, on a dark level, a lamp or a Scarab [29].
  • The Jungle: a 1 in 80 chance for each, or 1 in 60 on a graveyard level, after a dark level's roll for a Scarab [30].

Bats also appear wherever these are:

  • Olmec's yellow balls, which turn into a Bat, Spider, Snake, Frog or Fire Frog when they hit the ground [31].
  • The Tutorial, which has one [32].
  • Custom levels, as the level editor's tile b [33].

Tips

#
  • A hanging Bat doesn't wake for a player level with it or above it, only for one more than 16 pixels below its top, or when its ceiling is destroyed.
  • A Bat can be killed by jumping into it from below, as long as the player is higher than its middle when they touch.
  • Leading a Bat over Spikes or Lava doesn't kill it.

Trivia

#
  • The Bat's code never sets its type string, so it keeps the parent object's "None" [34]. The touch code checks for "Bat" twice, and neither check ever matches: a Bat that takes the player's last heart isn't counted in the deaths-by-enemy table the game writes to stats.txt, whose Bat row always reads ??? with 0 deaths, and the blood the code adds to a Bat's bite never appears [35] [36] [37].

FAQ

#
How much damage does a Bat do in Spelunky Classic?

1 heart per bite. Touching a Bat costs the player 1 heart, knocks him back and makes him invincible for 30 steps (1 second).

How do you kill a Bat in Spelunky Classic?

Hit it once with anything. A Bat has 1 hit point, so a Whip hit, a thrown item, a bullet or a Bomb kills it, and so does jumping into it: the game counts touching a monster from above its middle as a stomp while the player is jumping up as well as falling.

Where do Bats appear in Spelunky Classic?

Hanging under blocks in the Mines and the Jungle, the two areas whose level generation makes them. One of Olmec's yellow balls can also turn into a Bat, and the Tutorial has one.

Do Bats follow the player in Spelunky Classic?

Yes, while he's within 160 pixels: an awake Bat flies straight toward him, going up, down or sideways around a wall in its way. Farther away, it flies up to a ceiling and hangs there again.

Do spikes kill Bats in Spelunky Classic?

No. Spikes, Lava and Spear Traps hurt most monsters through code the Bat doesn't run, so they never harm it.

See also

#
Damaged by

References

#
  1. objects/oBat/create.gml:13
  2. objects/oEnemy/collision_oCharacter.gml:25
  3. objects/oBat/step.gml:67
  4. objects/oBat/step.gml:77
  5. objects/oBat/step.gml:93
  6. objects/oBat/step.gml:23-95
  7. objects/oBat/step.gml:23-30
  8. objects/oBat/step.gml:34-38
  9. objects/oBat/step.gml:65-69
  10. scripts/moveTo.gml:20-31
  11. objects/oBat/step.gml:39-58
  12. objects/oBat/step.gml:60-63
  13. objects/oBat/step.gml:71-80
  14. objects/oBat/step.gml:87-95
  15. objects/oBat/step.gml:1-3
  16. objects/oEnemy/collision_oCharacter.gml:14-25
  17. objects/oBat/step.gml:8-18
  18. objects/oEnemy/collision_oWhip.gml:1
  19. objects/oEnemy/collision_oCharacter.gml:6-10
  20. objects/oItem/step.gml:256-348
  21. objects/oBullet/collision_oEnemy.gml:16
  22. objects/oExplosion/collision_oEnemy.gml:14
  23. objects/oBat/step.gml:6
  24. objects/oEnemy/collision_oCharacter.gml:6
  25. Clip bat/jump-kill
  26. objects/oEnemy/step.gml:63-128
  27. objects/oBat/step.gml:11-16
  28. objects/oTransition/alarm_0.gml:125-130
  29. scripts/scrEntityGen.gml:45-63
  30. scripts/scrEntityGen.gml:262-272
  31. objects/oYellowBall/step.gml:4-19
  32. Room rTutorial, as the room editor placed it
  33. scripts/scrCreateTileObj.gml:127-130
  34. objects/oEnemy/create.gml:4
  35. objects/oEnemy/collision_oCharacter.gml:27-29
  36. objects/oEnemy/collision_oCharacter.gml:55
  37. scripts/scrWriteStats.gml:110-116

Source code

  • objects/oBat/create.gml
  • objects/oBat/step.gml
  • objects/oEnemy/create.gml
  • objects/oEnemy/collision_oCharacter.gml
  • objects/oEnemy/collision_oWhip.gml
  • scripts/scrEntityGen.gml
  • objects/oYellowBall/step.gml
#