Hello,
I am having issues figuring out a way to create an object from inside of another object. More specifically, I have a player that holds a gun that needs to fire a bullet.
What I have is a main World class which contains a vector of objects. This vector will run through a loop to do all the update logic/rendering for each object.
Now, I have a basic gun object. The player class will hold a pointer to this gun class. Where I am stuck is the creation of the bullet/projectile. The player will call a function on the gun class to initialize the bullet, but I don't have any idea how to get the bullet object into the objects vector in world in order to be displayed/etc.
Any ideas? Is my classes even right?