I'm trying to make a little space shooter, and I've gotten asteroids and the player to move but now I'm stuck on getting my space ship to shoot a bullet. All my tries have ended up as fails or worse(I've also tried posting this question on many other sites but ended up getting no/cruddy answers :/ I figured this would be the place to go). I need the bullet to be shot vertically... does anyone have some example source code I could look at, or can someone guide me through this step by step? If you want to see some code I've tried so far, just ask. Thanks.
Java2D space invaders tutorial. Should give you some ideas as it does go into shooting bullets. I have no experience with SDL so cant give any specific info.
I appreciate you help naraku, but unfortunately for me, I'm not that good as translating one programming language into another programming language :(. I'll try my best though.
(After trying: FAIL )
Just make some sort of a bullet object (probably with an x and y position) and increase (decrease?) it's y every frame. If you have some code you tried I could possibly help you fix it up.
And for some weird reason, I've even tried calling the shoot function(position function above), whenever the user holds down space and it wont show.... it only shows if I insert the function in the while loop in my main function :S