[SOLVED] - Using an cocos2d::Array of CCSprite at my Update (or Schedule)

Hi Guys,

I need some help to use a cursor of CCSprites on my “update” method. Look at my code:

PlayScene.H:

public:
cocos2d::CCArray arraySprite;
PlayScene.CPP - Method init:
arraySprite = cocos2d::CCArray::create;
After the instance of Array, my code call the method createSceneBackground;
PlayScene.CPP - Method createSceneBackground
for {
CCSprite
spriteImg = CCSprite::create(“image.png”);
spriteImg~~>setPosition );
arraySprite~~>addObject(spriteImg);
}
CCObject* objImagem = NULL;
CCARRAY_FOREACH(arraySprite, objImagem)
{
CCSprite img = dynamic_cast<CCSprite>;
this~~>addChild;
}
So far is working. All images are displayed in the scene.
Now I need to do some actions with my sprite after “0.5f”, the I create an update method and I registrated the method with this line:
this~~>schedule, 0.5f);
PlayScene.CPP - Method schedulePlay:
CCLog;
CCObject
* objNewImage = NULL;
CCARRAY_FOREACH(arraySprite, objNewImage) {
/* To do… */
CCLog(“Step 02”);
}

At the console I see the text “Step 01”, but I don´t see the “Step 02” and the APP exits afetr some seconds at my cellphone without a meessage error at the console.

Can anyone tell me what I’m missing?

The above code is only one part of the code, if necessary, can I put here on my topic “PlayScene.cpp” and “PlayScene.h”.

Thank´s

Hi Guys,

I found my error.

I read an article about retain and I forgot this:

arraySprite->retain();

Thank’s