Would it work if you had the barrel and chamber sealed by o rings rather than by welding or using compression fittings, so that when chamber moves forward, a bar will hit a hammer valve, which will fill the gun with air, then the chamber will move back, due to the pressure pushing it, exposing holes in the barrel, firing the projectile, then when the chamber is empty, a spring will move the chamber back into the beginning position, ready to start again.
It sounds complicated...and I assure you it is

not really, i will try to draw up a diagram explaining it.
Edit: Ive made a diagram... Its a bit jumbled so I hope it makes sense
