Use the up and down arrows to avoid the spikes.
This is a fairly easy game to code. I will give you permission to duplicate this and make it how you want.