I was wondering how that so-called "coilgun" works, I know what it does but I was wondering how it works under-the-hood and eventually how to make a basic one ? Also, how much energy would be required ?
A coilgun is a series of coils that are successively energized as a conductive projectile made from magnetic material passes by them.
As the conductive projectile approaches the air-core current loops, two things happen: the loop inductance increases and the projectile becomes magnetized. The magnetized projectile is then attracted to the loop magnetic field, accelerating towards it. As it approaches, inductance increases, completing a positive feedback loop such that the pull on the projectile and magnetic field created by the loops increase.
This process reaches a peak when the projectile is completely enclosed by the coil, where further travel decreases the loop's inductance. At this point, current through the loop is abruptly turned off so the projectile won't be slowed down by its continued attraction to the coil's magnetic field.
These are the basic physics principles by which a coil gun operates, which appears to be what you are interested in. There are many practical implementations.
First take a look at Wikipedia. The article is interesting starting point.
From what I see, since you just started studying them, the best start is to make an electromagnet. This way, you can familiarize yourself with calculation needed for your project since a coilgun is basically a special case of an electromagnet. I'll let you calculate what current and voltage you need. Just keep in mind the impedance of the coil and protection circuitry needed for transitions between on and off states. There are programs which can calculate inductance of a coil based on diameter of wire, number of turns and so on. I'll post a link as soon as I dig up from where I got mine. As for protection, you can find lots of tutorials for electric motors on the Internet. What you need should be pretty similar, since the coil is the main problem in both of them.
After you get your most basic magnet, you should take your time to calculate what type of projectile you'll use, what range you want and so on. Again, Wikipedia comes to rescue, but there are many other good sources on the Internet. When you get the force needed, you can start calculating parameters of the electromagnets you'd want to use.
After that, you'd need a circuit that can rapidly switch several electromagnets on and off. You may want to refresh your skills with digital electronics, since you could probably use some sort of counter for that, but I don't have much experience in that field, so I can't give you good advice. Microcontrollers would also be interesting, since you do C programming.
Of course you'd need a power supply too. If you go for low voltage capacitors with high capacity and high current, you could have a simple power supply, but it would take some time for it to charge the capacitors.
There's this guy called Afrotechmods on Youtube which has some tutorials on power supplies, large capacitors and catastrophic failures of electronic components.
Another easily overlooked aspect in this scenario are internal connection cables. You should make sure that they can sustain the currents which you plan to put through them. Just to be safe, use stronger cables that necessary.
There's also the safety issue. Best advice would be to get someone who has a lot of experience in this field to work with you. I do understand why your teacher doesn't want to provide you with information about this project. Capacitors can easily explode and supercapacitors even more so, power cables can melt and catch on fire, even if your calculations show that they should be able to sustain the current (this happened to me few days ago), you could get a short-circuit somewhere which could start fire, a part of the device which should be isolated may be under power when you touch it and that can lead to burns and so on. So my advice to you is to research how each component can fail, how to react when it fails and to be ready for it. Also, it would be a good idea to use components with higher rating than the one you need, just to be safe. Some newer components also have internal protections against over- (voltage, heating, current), short-circuits and so on. If you can obtain such components, do use them.
For the end, I'll just add that I'm intentionally vague in this answer. Each of the points I made is very wide and could take few questions just for itself. My idea was to give you an overview of what's needed before you start. You will need to do a lot of research!
Since you are new to coil guns I would recommend two courses of study to begin with. First understand that coil guns are just solenoids which are just inductors. The difference is you switch the coil off just before the middle of the projectile reaches the middle of the coil. In order to understand this you need a good understanding of Amperes Law and Faraday's law of Induction. Once you get a handle on those two things then it is all a matter of experimentation. I would further say that heeding all the advice about safety precautions above is wise indeed as I have very nearly been injured repeatedly by not observing those very pieces of advice.