Hey,

Is there anyway to control a volatile number of objects (don't know if I'm using the right term here... I mean when you don't know how many of an object you're going to have at any one time), like bullets in a shooter. If you have a bullet class, and you want to create a new object every time someone shoots, how would you go about it?

The only way I thought of was to figure out the maximum number of bullets there could be at once, then create an array with this many elements, and then fill it up and empty it out when a bullet is created or goes off screen. Is this the right way of going about it? Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.