Use the space bar and the up arrow to control your ship/yellow ball. You want to reduce the green ball/enemy ship's HP to 0 before he does that to you. There are many different moves to try. Comment which one is your favorite! Strafe is good against charge and retreat, but not so good against strafe or circle or harry. Charge is good against retreat but not strafe, circle, or harry. Harry is good against everything. Retreat is only good against charge.
If you want to make a fight simulator but don't want to write the code yourself just remix this project. The code is simple and self explanatory. Have fun!