What you need to do is accumulate the information for each laser blast in one place.
typedef struct _laser {
bool active;
int spriteNum;
int imageNum; // maybe not necessary in this case
int xPos; // where on the display - horizontally
int yPos; // where on the display - vertically
int speed; // this might need to be a float <shrug>
} LASER;
This establishes a collection of data that defines what a laser needs to know about itself and we created it as a new data type known as LASER. Then you can declare five laser blast as:
LASER laser1, laser2, laser3, laser4, laser5;
Each of these LASERs contains its own data and you can assign something to a member of the LASER by doing something like:
laser1.xPos = screenWidth/2; // or whatever
laser1.yPos = screenHeight/2; // or whatever
laser1.speed = 3; // or... oh, never mind
laser1.active = true; // make sure it knows it's time to go to work
The dot (.) indicates to use the specific variable member within the LASER.
Or better yet, make array like the following:
LASER allLasers [5];
which declares an array of LASERs and you can access the variables of the individual LASERs like the following:
allLasers [0].xPos = 238;
allLasers [0].yPos = 10;
Then you can do something like
for (int i = 0; i < 5; i++ {
if (allLasers[i].active == true) {
// do that voodoo you do so well
allLaser[i].yPos += speed;
dbSprite (allLasers[i].spriteNum, allLasers[i].xPos,
allLasers[i].yPos, allLasers[i].imageNum);
// and all that jazz
}
}
The same technique can be used to hunt for a laser blast that that's not active and use that to set the initial position and speed then turn it active.
Lilith, Night Butterfly
I'm not a programmer but I play one in the office