This is just a small test I made a while ago. Have a go with it. Use arrow keys and press space on the enemy. Remix and mess around with the variables if you want to use it at its full potential.