I'm making a space invaders clone with SDL, as part of my learning. I want the player to be able to shoot a bullet. I have a bullet class. In short, I want a new instance of the bullet class to be created every time space is pressed, and I want this instance of the class to be public. In more detail:
Here is a function from bullet. When I try to reference "adsf" from say, my main function, with like asdf -> move();, gcc says that asdf was not declared in this scope and it dosn't compile. Could I have any pointers (no pun intended ;D) from you guys please?
Well yea, but it's inaccessible from anything outside that if block. And you're not freeing the memory so it's just gonna be sitting in memory unusable even after your done with it. This happens every time you shoot, and I imagine a lot of shooting in space invaders. As you can imagine, this is gonna lead to a whole lot of of unfreed memory.
Hmmm. I must look at the source of other programs and read some more because currently, (and i'm guessing due to my draw() function), my program does not work the way I want it to. Thanks for the help.
Live long and prosper