bool EntryLayer::init(){ bool isRet=false; do { this->entry_index = 1; // setTouchEnabled(true); // CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, 0, true); CCTextureCache::sharedTextureCache()->addImage("scene/tap_to_continue_1.png"); CCTexture2D *continue_pic1 = CCTextureCache::sharedTextureCache()->textureForKey("scene/tap_to_continue_1.png"); CCSprite* tapToContinue = CCSprite::createWithTexture(continue_pic1); tapToContinue->setAnchorPoint(ccp(0,0)); tapToContinue->setScale(0.5); tapToContinue->setPositionX(tapToContinue->getContentSize().width*0.7); CCAnimation *continueAnimation=CCAnimation::create(); continueAnimation->addSpriteFrameWithFileName("scene/tap_to_continue_1.png"); continueAnimation->addSpriteFrameWithFileName("scene/tap_to_continue_2.png"); continueAnimation->addSpriteFrameWithFileName("scene/tap_to_continue_3.png"); continueAnimation->addSpriteFrameWithFileName("scene/tap_to_continue_4.png"); continueAnimation->setDelayPerUnit(1); continueAnimation->setRestoreOriginalFrame(true); CCAnimate *continueAnimate=CCAnimate::create(continueAnimation); tapToContinue->runAction(CCRepeatForever::create(continueAnimate)); this->addChild(tapToContinue, 100); CC_BREAK_IF(!BaseLayer::init()); CC_BREAK_IF(!setUpdateViews()); isRet=true; } while (0); return isRet; }
void EntryLayer::changeScene2(float) { if (entry_index == 6) { CCScene* se = LoadingWelcomeLayer::scene(); CCLOG("start change scene"); CCDirector::sharedDirector()->replaceScene(CCTransitionCrossFade::create(0.5,se)); } this->entry_index++; setUpdateViews(); }
void EntryLayer::changeScene() { if (entry_index == 1) { this->removeChild(entry_I); } if (entry_index == 6) { CCScene* se = LoadingWelcomeLayer::scene(); CCLOG("start change scene"); CCDirector::sharedDirector()->replaceScene(CCTransitionCrossFade::create(0.5,se)); } CCLOG("EntryLayer before changeScene: %d", this->entry_index); this->entry_index++; setUpdateViews(); }
bool DefenderGameLayer::init(){ bool isRet=false; do { CC_BREAK_IF(!BaseLayer::init()); this->interval=4; this->monsterBatch=10+CheckpointSystems::monsterBach(); //this->monsterBatch=1; this->monsterBatchNow=0; CC_BREAK_IF(!setUpdateViews()); this->schedule(schedule_selector(DefenderGameLayer::detectd)); isStop=false; isRet=true; } while (0); return isRet; }