How do you put sprites in a global array?
I want something along the lines of
arrayName[2]= {sprite1, sprite2};
with arrayName able to be accessed anywhere.
How do you put sprites in a global array?
I want something along the lines of
arrayName[2]= {sprite1, sprite2};
with arrayName able to be accessed anywhere.
I have found the answer here. One thing I changed was the first part. Instead of std::vector<Sprite*> clouds;
i used std::vector<cocos2d::Sprite*> clouds;
Apart from that, it works perfectly.
sure, that makes sense if you don’t have a using namespace cocos2d;
someplace.
So that’s what it’s for, I saw tutorials using it but I didn’t understand why you needed it. Thanks!
This:
using namespace cocos2d;
std::vector<Sprite*> clouds;
and this:
std::vector<cocos2d::Sprite*> clouds;
are the same. I prefer to fully qualify my types, but that is just me.