A couple of small space-shooter sketches I made on CodePen, using JavaScript and Canvas.

The first version is just a ship, a scrolling starfield and shooting. The second adds enemies that move towards the ship, with some basic collision detection for the bullets.

Both versions are embedded below, without enemies first. Click inside the first demo, then use the arrow keys to move and Space to shoot.

The enemy version currently needs a compatibility fix before it will run again.