Level 1: collect stars as they come in waves, and watch out for enemies. Hats help you on your way. Level 2: collect stars and shoot enemies. Be sure to keep your star count above 0 and keep an eye out for the final boss.
Level 1: use the left key to turn left, the right key to turn right, the spacebar to jump and Ctrl to shoot a fireball. Level 2: use the left key to turn left, the right key to turn right, the up arrow to go up, the down arrow to go down and the spacebar to shoot.