Shooting, starfield, how?

I’m currently working on my first game(a semi-2d space shooter) in opengl and I am having some troubles

I was thinking to handle shooting, enemies, explosions, afterburner and so on with a particle engine.

I now have the afterburner quite good and i am about to start with shooting/scrolling starfield (whichever i get working first )and i have bumped into a few problems:

Shooting: I am having problems being able to actually shoot when control is pressed, i could use a similar technique to what i used in my afterburner but it would be like a machine gunm that would be hard to control, what i would like is a “one shot per press”

Starfield: The positioning of the stars so that they are within view, and also the scrolling i find hard

Thanks for your time, probably simple sulutions to both the problems

Shooting is more related to C/C++ than to OpenGL. Its controlled by the keystroke handler. When the shoot key is pressed, fire the shot and then set a state to say that the shot has been fired. When the key is released clear the state. Each time you’re about to fire the shot test the state first. If it is set don’t bother. This is necessary since you might get more than one keypressed event if you hold down a key, and you want the shot to be fired only the first time the event happens for a keypress.

The positioning of the star field will depend on how you translate it. Try nehe’s website . It might have tutorials on the subject.

I don’t know if this helps, but you may want to check out for an example.

The skymap is probably usable as is, and the animated starfield could be changed to shoot particle weapons very easily.

Also, SpaceTime uses my free 3DS mesh loader to import 3D Studio MAX artwork which may be useful to your game… dunno.

Complete source code is available for the price of a pint of Double Diamond, plus a tip for my buxom barmaid.