You can just export a spritesheet of the character without a hat and with a hat, how you implement that in your game is up to you though.