示例#1
0
 void ComicScene::cleanPages() {
     if ( currentPage == 1 || currentPage > this->totalPages) {
         return;
     }
     int textTag;
     int imageTag;
     if ( currentPage == 2 ) {
         imageTag = 1;
         textTag = 2;
     } else if ( currentPage == 3 ) {
         imageTag = 3;
         textTag = 4;
     }
     CCSprite* currentImage = (CCSprite*)this->getChildByTag(imageTag);
     CCLabelBMFont* currentText = (CCLabelBMFont*)this->getChildByTag(textTag);
     currentImage->stopAllActions();
     currentImage->setOpacity(0);
     currentText->stopAllActions();
     currentText->setOpacity(0);
 }
示例#2
0
KDvoid CScrGame::onEnterTransitionDidFinish ( KDvoid )
{
	CCLayer::onEnterTransitionDidFinish ( );

    CCFiniteTimeAction*  pAction = CCSequence::create 
    (
        CCSpawn ::create ( CCScaleTo ::create ( 0.7f, 3 ), CCFadeIn::create  ( 0.7f ), KD_NULL ),
        CCRepeat::create ( CCSequence::create ( CCFadeOut::create ( 0.5f ), CCFadeIn ::create ( 0.5f ), KD_NULL ), 3 ),
        CCSpawn ::create ( CCScaleTo ::create ( 0.7f, 10 ), CCFadeOut::create ( 0.7f ), KD_NULL ),     
        CCCallFuncN::create ( this, callfuncN_selector ( CScrGame::onStart ) ), 
        CCCallFuncN::create ( this, callfuncN_selector ( CScrGame::onRemove ) ), 
        KD_NULL
    );
    
    CCLabelBMFont*   pStart = g_pResMgr->getLabel ( this, "Game Start !!!" );
    
    pStart->setPosition ( ccpMid ( CCDirector::sharedDirector ( )->getWinSize ( ) ) );
    pStart->setScale ( 10 );
    pStart->setOpacity ( 0 );
    pStart->runAction ( pAction );
}
示例#3
0
文件: GameOver.cpp 项目: jindaw/learn
void GameOver::initData()
{
    // clean Txt
    CCSprite* cleanSprite = CCSprite::createWithSpriteFrameName(rewardUI[kTypeClearn]);
    cleanSprite->setPosition(ccpAdd(m_ptCenter, ccp( 150, 100)));
    cleanSprite->setTag(kTypeClearn);
    cleanSprite->setOpacity(0);
    this->addChild(cleanSprite);
    
    // reward background
    CCSprite* rewardBGSprite = CCSprite::createWithSpriteFrameName(rewardUI[kTypeNomalBG]);
    rewardBGSprite->setPosition(ccpSub(m_ptCenter, ccp(0, 100)));
    rewardBGSprite->setTag(kTypeNomalBG);
    rewardBGSprite->setOpacity(0);
    this->addChild(rewardBGSprite);
    
    //reward score
    CCLabelBMFont * rewardScore = CCLabelBMFont::create("0", rewardUI[ktypeScore]);
    rewardScore->setAnchorPoint(ccp(0.5f, 0.5f));
    rewardScore->setPosition(ccpSub(m_ptCenter, ccp(0, 200)));
    rewardScore->setTag(ktypeScore);
    rewardScore->setOpacity(0);
    this->addChild(rewardScore);
}
示例#4
0
void WordPuzzleLayer::didCorrectCharacterSelected(CCArray* wordIdxArray, int index)
{
	//맥스 콤보 업데이트
	combo++;
	if (report.maxCombo < combo) 
	{
		report.maxCombo = combo;
	}
	
	SimpleAudioEngine::sharedEngine()->playEffect("sound/main_card_popup.mp3");
	char buf[20];
	
	CCSprite* sprMultiplier;
	
	if (combo < 5) 
	{
		sprMultiplier = NULL;
		multiplier = 1;
	}
	else if (combo < 10)
	{
		// x2
#if (defined PD_IPHONE) || (defined ANDROID_PHONE)
		sprMultiplier = CCSprite::spriteWithFile(__CONFIG_IMAGE_PATH_GAME__("effect/game_double_01.png"));
#else
		sprMultiplier = CCSprite::spriteWithFile("game/effect/game_double_01.png");
#endif
		multiplier = 2;
	}
	else if (combo < 20)
	{
		// x4
#if (defined PD_IPHONE) || (defined ANDROID_PHONE)
		sprMultiplier = CCSprite::spriteWithFile(__CONFIG_IMAGE_PATH_GAME__("effect/game_double_02.png"));
#else
		sprMultiplier = CCSprite::spriteWithFile("game/effect/game_double_02.png");
#endif
		
		multiplier = 4;
	}
	else if (combo < 30)
	{
		// x8
#if (defined PD_IPHONE) || (defined ANDROID_PHONE)
		sprMultiplier = CCSprite::spriteWithFile(__CONFIG_IMAGE_PATH_GAME__("effect/game_double_03.png"));
#else
		sprMultiplier = CCSprite::spriteWithFile("game/effect/game_double_03.png");
#endif
		multiplier = 8;
	}
	else if (combo < 50)
	{
		// x16
#if (defined PD_IPHONE) || (defined ANDROID_PHONE)
		sprMultiplier = CCSprite::spriteWithFile(__CONFIG_IMAGE_PATH_GAME__("effect/game_double_04.png"));	
#else
		sprMultiplier = CCSprite::spriteWithFile("game/effect/game_double_04.png");	 
#endif
		
		multiplier = 16;
	}
	else 
	{
#if (defined PD_IPHONE) || (defined ANDROID_PHONE)
		sprMultiplier = CCSprite::spriteWithFile(__CONFIG_IMAGE_PATH_GAME__("effect/game_double_05.png"));	 
#else
		sprMultiplier = CCSprite::spriteWithFile("game/effect/game_double_05.png");	 
#endif
		
		multiplier = 32;
	}


#if (defined PD_IPHONE) || (defined ANDROID_PHONE)
	CCSprite* label = CCSprite::spriteWithFile(__CONFIG_IMAGE_PATH_GAME__("effect/game_up.png"));
#else
	CCSprite* label = CCSprite::spriteWithFile("game/effect/game_up.png");
#endif
	
	label->setPosition(pointLabelPosition);
	this->addChild(label, 9999);
	
	if (sprMultiplier) 
	{
		sprMultiplier->setAnchorPoint(ccp(0,0.5));
#if (defined PD_IPHONE) || (defined ANDROID_PHONE)
		sprMultiplier->setPosition(ccp(label->getContentSize().width - 5,35));
#else
		sprMultiplier->setPosition(ccp(175,35));
#endif
		label->addChild(sprMultiplier);
	}


	
	label->setScale(0.2);
	
	CCEaseExponentialOut * fadeout = CCEaseExponentialOut::actionWithAction( CCActionTween::actionWithDuration(1.5,"opacity",255,0) );
	CCCallFuncN* callfunc = CCCallFuncN::actionWithTarget(this, callfuncN_selector(WordPuzzleLayer::onPointLabelFadeOut));
	
	label->runAction(CCMoveBy::actionWithDuration(0.8, ccp(0,100)));
	label->runAction(CCEaseBounceInOut::actionWithAction(CCScaleTo::actionWithDuration(0.3,labelScaleTo)));
	label->runAction(CCSequence::actions(CCDelayTime::actionWithDuration(0.7),fadeout,callfunc, NULL));

	
	if (combo > 2)
	{
		sprintf(buf, "%dCombo",combo);
		CCLabelBMFont* lblCombo = (CCLabelBMFont*)getChildByTag(TAG_COMBO);
		
		CCEaseExponentialOut * fadeout = CCEaseExponentialOut::actionWithAction( CCActionTween::actionWithDuration(1.5,"opacity",255,0) );
		CCCallFuncN* callfunc = CCCallFuncN::actionWithTarget(this, callfuncN_selector(WordPuzzleLayer::onPointLabelFadeOut));
		
		if (lblCombo)
		{
			lblCombo->setString(buf);
			
			lblCombo->stopAllActions();
			lblCombo->setOpacity(255);
			lblCombo->setPosition(comboLabelPosition);

			lblCombo->setScale(0.2);			
			lblCombo->runAction(CCEaseBounceInOut::actionWithAction(CCScaleTo::actionWithDuration(0.3,labelScaleTo)));
			lblCombo->runAction(CCSequence::actions(CCDelayTime::actionWithDuration(1.5),fadeout,callfunc, NULL));
		}
		else
		{
			lblCombo = CCLabelBMFont::labelWithString(buf, "font/combo.fnt");
			lblCombo->setPosition(comboLabelPosition);
			
			this->addChild(lblCombo, 9999, TAG_COMBO);
			
			lblCombo->setScale(0.2);			
			lblCombo->runAction(CCEaseBounceInOut::actionWithAction(CCScaleTo::actionWithDuration(0.3,labelScaleTo)));
			lblCombo->runAction(CCSequence::actions(CCDelayTime::actionWithDuration(1.5),fadeout,callfunc, NULL));
		}
	}

		
	
}