If you short a high voltage capacitor through an inductor, it creates an electromagnetic field that can act on a metal projectile. If you stack multiple inductors along a tube and trigger them with photogates, you can get the projectile to go pretty fast. I used this concept to build a electromagnetic rifle (Multistage Coilgun) as my high school senior project.
It was a 3-Stage coilgun, and I used it to obliterate apples, glass bottles, and ceramics.