Hi everyone, I'm learning C++ and I have a question -
say i'm making an Invaders game, and if the user hits spacebar, a "fire weapon" function (lets call it fireWeapon(); ) is called.
so I guess i'd have to use a new pointer here? say I have a bullet class with coordinates and other stuff, in the fireWeapon() i'd go:
Bullet bullet = new bullet,
my question is really simple, how to I handle this new bullet? i know that since it's new, it won't go out of scope when the function is ended, but should I be returning the pointer from fireWeapon? or passing it to a different function?
and say the bullet is not deleted, then i'm firing another bullet and there are 2 bullet objects - where should i "store" them after declaring them? i'm sure i'm missing something, its a bit confusing to me :P
thanks and sorry for the bad english