In order for the toad to catch the wizard hat, you must use the left, right, up, and down arrow keys. These will help you control the toad.
Credits to Scratch for having wonderful tutorials to follow!