I've been using C++ for awhile now but just started with game development kind of recently. I recently ran into a problem when starting to work on a new game, I'm not sure if I'm missing something from basic C++ or I'm just looking at the problem wrong. Basically, I'm not sure how to dynamically create objects when I'm not sure of how many objects I will need (if that makes sense/if I'm using the right terminology).
With things like bullets that I have a set maximum for, I can use an array. For example: I can have a bullet class (lets call it 'bullet') and a player class that has an array like:
Code: Select all
class bullet;
class player{
//other stuff for player class here
private:
bullet bullets[20];
};
So, am I missing something in basic c++ that I should go back and learn? When I've tried Google for this I've come up with nothing helpful so I would assume that my problem is simply missing something that I should know from learning C++ or I'm just looking at this problem in the wrong way. I'm just hoping one of you could point me in the right direction, thanks in advance!