Hearts can be obtained by buying soda from the Vending Machines that are scattered around th
e world of Madotsuki's dreams. They appear to have no real purpose in the game as enemies cannot drain health from you. They were a part of the RPG game engine used to create Yume Nikki, and the feature was not implanted into the game. However, they're the only thing you can really spend your money on, and so people find it enjoyable to simply blow all of their profits on this feature for show.