On snowman’s land get your hat blown off by the big snowman head. Do not pick it up, but instead go to one of the levels warps. Go across a warp and go back to where the hat is. Pick it up. You will now notice that even though your hat is now on your head, there is another on the ground. Pick the second one up. You will now have a hat in your hand. It can now be used as a weapon.
On shifting sand land get your hat stolen by Klepto the condor. Do not pick it up, but instead go to the warp under the tree next to the oasis. Go warp across and back. Walk over to the hats. Like before there will now be several hats on the ground. Pick them all up. You will now have a hat in your hand. It can now be used as a weapon.
The Dark World
After collecting 120 stars, fire yourself out of the cannon up onto the castle roof. Collect the wing cap and go back to the cannon. Fire yourself towards the very top of the castle. You should be standing near the side of the top tower. Go to the side that faces the bridge and walk towards it. The first thing that should happen is you walk up the wall as if it is a hill, and then you fall back down. Once you have fallen back off the wall, if you were still holding up, you should fall straight through the castle wall and into a small black carpeted area behind the door. If you walk through the door you should find yourself in the same place, but this time, inside the castle instead of outside. Walk through the wall once you hear the inside the castle music. You are now inside the castle.