Bats spawn clinging to ceilings in the way spiders do, and will begin to fly at you if you move into the parabolic area below them, even if there is no line of sight. Bats will always attempt to fly directly at you, with very little path-finding intelligence.
The main difficulty when dealing with bats is that they tend to approach from above where it can be tricky to hit them, as the Whip has a bit of a blind spot in diagonal direction when whipping in front of oneself.
The best course of action when dealing with bats is to run backwards or get to high ground, then wait for the bat to come to you. This will help to level the dangerous height difference and reduce the reliance on one's reflexes.
Otherwise, the player should use the commonly accepted technique know as back whipping. By letting the bat approach them first, the player can hit them with the back part of their whip as it covers a larger area above and behind them.
Otherwise, the player can simply throw an item at the bat, killing them.
The player should beware of being trapped in a place where the bat will fly down directly on top of them; It is very difficult to hit enemies directly above oneself with the whip. It is much more reliable to throw a rope to kill them with the grappling hook, although this is a waste of precious equipment and only a little better than losing a hit point.