Edit: Sorry for this question, really don’t know what I was asking for. Stackoverflow does not allow me to delete this question lol. If a mod sees this, please just delete.
Here’s a "minimized" version of the code I’m having problems with:
class Texture {
};
class MyClass {
static Texture Image;
};
int main() {
vector<MyClass> Zombies; // The array Increases in the program
MyClass Player;
return 0;
}
So my problem seems to be that the two objects uses the same texture, I know that’s how static works, but I don’t know how I can make a static that just covers up each array.
If I understand correctly, you want one texture for the entire array of Zombies and another texture for Player.
There’s no way to do this automatically – your choices are to have all instances of the class share a single
staticmember, or have each object contain its own.If you break out the texture separately and have the objects contain a reference or pointer instead, you can share the texture objects that way. It will be up to you to initialize the reference or pointer in the constructor of each object.