Hi,
I upgrade the version of Cocos2d-x in my games, I used 1.12.0 and now I change to 2.0.1, I change a lots of code, it’s easy, but this part of my code I can’t change.
I know that I need to change CCMutableArray to CCArray, but I don’t know how to iterate using a CCArray
CCMutableArray::CCMutableArrayIterator itEner;
for (itEner = _energys->begin(); itEner != _energys->end(); itEner++) {
CCSprite *energy = (CCSprite *) *itEner;
if (!energy->getIsVisible())
continue;
if (CCRect::CCRectIntersectsRect(_ship->boundingBox(),
energy->boundingBox())) {
energy->setIsVisible(false);
}
}
Yeah, the CCArray is even more confusing than CCMutableArray was And I ended up with lots of memory errors, the retain release mechanism is so confusing on the CCArray and the objects inside that I ended up writing a simple linked list class for some of my old CCMutableArray’s.
Anyway, I think you need something like (not tested):