New to Cocos and trying to safely delete any CCSprite that exits the screen. I’ve got the logic that checks if the sprite is on the screen, but I don’t know how to safely delete it.
Bead extends CCSprite and is called like this
Bead* bead1 = Bead::create(size.width*2, size.height*2, “1”);
Meanwhile in my Bead.cpp…
Bead* Bead::create(int x, int y, CCString n)
Bead *bead = new Bead();
if (bead && bead~~>initWithFile)
bead~~>name = n;
The reference that I have to the Bead looks like this…
Bead* aBead = dynamic_cast<Bead*>(movingBeads->objectAtIndex(i));
I’ve tried aBead~~>release(); and delete aBead, but nothing seems to work right. Any help would be great.