layer and scene problem

layer and scene problem
0.0 0


I have making the game.
The game have 60 level.
All of the level play different.
so i have 60 method to control the different level.
I just coding in the one layer.
When i open the game and pause the game in the android device.I need to load more then 7 sec.
i don’t know the game will load all the code when i open the game or not.

I want to solve the problem.

Should i create the layer for any Level?
Please tell me how to solve it.


Maybe best solution for this problem make each level was in one scene with one layer?


how can i change the scene when i click the button.
How to set the new cpp and h file to packing to android file.
When i use the Cygwin to package the android file, it will return the error.


i create the new ccp and h file.
It can run in my computer.
When i build to the android file.
It return the error.
You can see the building_error.png.


You need to add your CPP files in the jni/ file. Look for the line that says @LOCAL_SRC_FILES@

It should look like this:

LOCAL_SRC_FILES := helloworld/main.cpp \
                   ../../Classes/AppDelegate.cpp \
                   ../../Classes/HelloWorldScene.cpp \
                   ../../Classes/MyOwnClass1.cpp \
                   ../../Classes/MyOwnClass2.cpp \

Add all the CPP below the HelloWorldScene.cpp line and add a \ at the end. When you get to the last file, do not add \


i solve it. Thanks you~


i have try to use the replaceScene to change the Scene.
Then, i have change to second Scene and stop the first scene background music.
But the first Scene background will auto play in this time.

void Level1_Layer::Anim_rainbow_1()
if ( rainbow_Anim_Running_1 false )
CCSize s = CCDirector::sharedDirector()->getWinSize();
CCSpriteFrameCache* cache = CCSpriteFrameCache::sharedSpriteFrameCache();
rainbow_Sprite_1 = CCSprite::spriteWithSpriteFrameName(“win20001.png”);
rainbow_Sprite_1->setPosition( ccp( 5000,5000) );
rainbow_Sprite_batch_1 = CCSpriteBatchNode::batchNodeWithFile(“win_rainbow.png”);
if( preload_rainbow_Anim_1 true )
rainbow_Anim_Running_1 = true;
rainbow_Sprite_1~~>setPosition );
CCArray* animFrames1 = CCArray::arrayWithCapacity(36);
char str1[100] = {0};
for(int i = 1; i < 36; i++)
sprintf(str1, “win200%02d.png”, i);
CCSpriteFrame* frame = cache~~>spriteFrameByName;
CCAnimation* animation1 = CCAnimation::animationWithSpriteFrames(animFrames1, 0.04f);
CCFiniteTimeAction* actionAnim = CCAnimate::actionWithAnimation(animation1) ;
CCFiniteTimeAction* actionMoveDone = CCCallFuncN::actionWithTarget( this, callfuncN_selector(Level1_Layer::Anim_rainbow_Finish_1));
CCDelayTime* waiting = CCDelayTime::actionWithDuration(0.2f);
}else {
preload_rainbow_Anim_1 = true;
void Level1_Layer::Anim_rainbow_Finish_1
this~~>removeChild(rainbow_Sprite_batch_1, true);
rainbow_Anim_Running_1 = false;
cocos2d::CCScene pNewScene = cocos2d::CCScene::node;
pLayer = HelloWorld::node;
i can’t use the call back function, it will return the error about “this” can’t found the symbol.
CCFiniteTimeAction* actionMoveDone = CCCallFuncN::actionWithTarget);

But i have use the call back function in the other method. It is work.

CCFiniteTimeAction* actionFadeOut = CCFadeOut::actionWithDuration0.5);
Level1_photo2~~>runAction( CCSequence::actions(actionFadeOut, NULL) );
CCFiniteTimeAction* actionMove = CCMoveTo::actionWithDuration( (ccTime)1, ccp(size1.width/2, size1.height/2));
CCFiniteTimeAction* actionMoveDone =
CCCallFuncN::actionWithTarget( this,
Level1_photo5->runAction( CCSequence::actions(actionMove,
actionMoveDone, NULL) );

what is the problem? this two method is in the same scene.