I am currently writing a top down-ish shooter in C++. I've got most of the graphics routines done, but I am wondering how to implement a shooting routine.
Some thoughts were:
1. When the user presses [shoot], a new bullet structure is created and inserted into an array, bullets[number of bullets]. Then during the rest of the loop, this array is calculated and bullets are moved, etc.
The problem is that when bullets "die" (hit a wall, go off the screen), how do I remove them from the array, and create a "free space" to put the next bullet in?
And how would you cope with Unlimited Bullets - i.e. being able to shoot as quickly and as much as you want - NOT just having 8 shots on the screen, and you have to wait for these shots to "die" before you can shoot again.
This is the only practical method I can think of, if you have any suggestions, please help me out here!