So everybody probably remembers good old "Duck Hunting" on NES. Recently i stumbeled on to an article that describes how the light gun used to play it works. We've all wandered how it worked when we was kids, so here it is for you who are still wandering :).
The Zapper was first released in 1985 with the launch of the NES in North America. It came bundled with the NES console, the Robotic Operating Buddy and two games—Duck Hunt and Gyromite.
The Zapper is used on supported NES games such as Duck Hunt and Wild Gunman. To hit targets on the screen, players point the device by lining up the front and rear sights with the desired target and pulling the trigger. The Zapper could also be used on the title screens of games to move the cursor—done by pointing the device away from the screen and pulling the trigger—or starting the game (pointing at the screen and pulling the trigger).
When the trigger on the Zapper is pressed, the game causes the entire screen to become black for one frame. Then, on the next frame, the target area is drawn in all white as the rest of the screen remains black. The Zapper detects this change from low light to bright light, as well as at which screen position the change was detected. This is how the game knows which target has been hit. After all target areas have been illuminated, the game returns to drawing graphics as usual. The whole process is almost imperceptible to the human eye, although one can notice a slight "flashing" of the image.