Head left through the area, past a ladder hanging from above (you can come back to it later), and you'll be abe to enter a clothing store.
In the shop, you can part with 1000 gold three times, while talking to each of three people who just happen to be that much short. When you have done so, you'll unlock the "Nice Hat" feat. Then Mr. Hat will comment about his precious hats and a battle follows.
Mr. Hat
This is a simple battle, as long as you keep close to your foe. You can hit him with downward thrusts and bounce around after him, continuing to bring the pain. If you stick close to him, most of his attacks won't cause you much harm.
When Mr. Hat stops and lands, you can also hit him a few times with a regular horizontal thrust, and it's not a bad idea to use your Phase Locket ability to make yourself invincible. Your foe has a pretty decent-sized life meter, but since you can often land a few blows at once, you should be able to make short work of it.
Once you defeat Mr. Hat, you'll receive 5000 gold, which more than makes up for your charity a moment ago. Mr. Hat will leave the shop.
You should also leave and head back to the right. Near the ladder, hop onto the top of the well and then from there leap up to grab the ladder. Ascend to the shop overhead, where you can talk to the large fellow at the forge. He will offer armor variations, while the man to the left can upgrade your shovel blade.
Travel left from those two fellows. You can either climb a ladder here to a rooftop and find a
Music Sheet and a catapult that can launch you quickly to the Village region, or you can drop through an opening to land on the rooftops below. Then you can hop to the rooftop to the left to talk to Mr. Hat for another 1000 gold. From there, leap along the roofs leading back to the right to find another
Music Sheet. When you're done upgrading, you're also done in this area, at least for now. You can always come back later.
NEXT: Forest of Phasing