This might be a better example than the Unity Invaders thing. It’s really basic, and not even a complete game. (No scoring, goals, lives, etc., which I figure has been covered well enough elsewhere.) Just 100% pure 2D, no fancy stuff.
This way there isn’t much code, but what is there is still completely functional, hopefully…
It builds a level from a text file: “X” = wall, “o” = turret, “.” = save point, “1” = player’s ship. It figures where the straight edges, corners, etc. should be, so you just use “X” for a wall and it will do the rest. The level can be any arbitrary dimensions…20x20 (like the one included), 33x5, whatever. There’s some basic error checking, so it’s OK to do stuff like hit return at the end of the last line (any lines not the same length as the first are ignored), or include a bunch of "1"s in an attempt to make multiple player ships (only the first is used).
Probably it would be best if the level were built into a combined mesh (or at least used the mesh combine utility), but that’s somewhat more complicated for just a basic example like this. Right now each tile is a separate object. Still, it gets ~460fps on my G5, so it’s probably not that big a deal in this case.
If you had really huge levels or more detail, like smaller tiles, it would become more important.
It uses raycasting to check for wall collisions; this way the tile graphics can be shaped like anything and the collisions are still pretty accurate. If you want, you can add additional raycasting points to the ship for more accurate wall collisions. Right now there are just three, one at each corner, which seemed OK most of the time. To add more, drag the Ship prefab into the scene view or hierarchy, making sure you have a top view with orthographic view on, and hit F to focus on it. Duplicate one of the little RaycastPoint spheres that are children of the ship (it will lose the prefab connection, which is OK), and position it where you want. Repeat as desired, then select the parent ship and do GameObject → Apply Changes To Prefab from the menu, and get rid of the ship object in the hierarchy. The spheres obviously get turned off when the ship is instantiated, and are just there to provide a visual reference. More points = more raycasting = slower, but then again, at 460fps, I probably could have added some more without much impact…
You can also fiddle with various parameters on the Ship prefab (speed, bullet speed, etc.), and on the TurretTrigger prefab (rotate speed, repeat rate, etc.). Plus a lot more, of course, if you want to mess with the scripts. Default controls = left/right arrows to rotate ship, up arrow to move forward, space to fire, R to reset. Have fun. 
Edit: there’s an updated project below…the only reason to look at this one is if you want to see the text file → map code for some reason.
–Eric
56631–2058–$2dshooter_132.zip (1.53 MB)