I have code
Rock::Rock(HelloBom *helo) :hellobom(helo)
{
for (int i = 1; i <= number; i++)
{
addChild();
}
CCLOG("data size :%d", da.size());
hellobom->schedule(SEL_SCHEDULE(&Rock::update), 1.0f / 60.0f);
}
hellobom is layer.
Rock is normal class.
and :
void Rock::update(float dt)
{
CCLOG("data size update:%d", da.size());
int chec = check();
if (chec != 1000)
{
Sprite *sprite = da[chec];
CCLOG("check successfully");
hellobom->removeChild(sprite);
remove(sprite);
addChild();
}
bunchOutSide();
}
In output window output :
data size :3
data size update:0
data size update:0
data size update:0
schedule make da have size equals 0.Where is mistake?