I've not done the multiple bullet stuff yet, just trying to take it a step at a time, with the first being making a bullet class. I get the error "illegal call of non static member function" that I dont know how to solve. Any help?
I beleive what you did is put your code for the Shootfuntion() source outside of the declared class. In your class after the shootfuntion() you have to put your code. You cannot put it outside then expect to call the outside function and place that code in there.
When you call the shootfunction() function with the class it goes into the class and executes the instructions within the function inside of the class.
Also....bullets is just a class. So i dont beleive you can use bullet.x and declare a value to it.
you could however make a member of the bullet class by doing the following.
1 2 3 4 5
Bullet shotgun
/* you have now made a member called shotgun that contains all the values you specified in bullet. Now you can do the following. */
shotgun.x= /* you would put your x coordinate */
i might be wrong but i think i am right because you can have multiple types of bullets. I am pretty sure once you make the class you have to precede it with a type somewhere in the code. Unless if that is only for structs.
There are a few potential problems that can't be resolved without seeing the entire code, but your static problem is because at line 31 you have Bullets::shootfunction();.
This syntax is a call to the static function 'shootfunction' from class Bullets. However, 'shootfunction' hasn't been declared static; that's what the compiler is telling you. Presumably the error contained a line number referring to line 31?
Bullet.x was the sprite Bullets was the class, sorry for the confusion. Anyway, I was going about it the wrong way so I've started over. Quick question though:
I have a class for a bullet, but a lot of the initialisers that are used to draw a sprite will need to be accessed by the class. The only way I could get it to work is to initialise everything in the class, but then I get redefine errors form main that also needs them. How do I fix this?
I have never used a class because i get compiler errors in the opposite way when trying to use a class to contain variables. Whenever i try to initialize a value to the variables inside of the class i get errors. It may be specific to the compiler you are using.
I just initialize all my variables globally and have global functions even though this takes up more cpu usage supposedly it is not even noticeable.