I think you attack, spend a sword, and lose a heart when you run into an enemy while you have swords. Otherwise, you just lose a heart.