예제 #1
0
//------------------------------------------------------------------
//
// SpriteProgressToRadialMidpointChanged
//
//------------------------------------------------------------------
void SpriteProgressToRadialMidpointChanged::onEnter()
{
    SpriteDemo::onEnter();

    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCProgressTo *action = CCProgressTo::create(2, 100);

    /**
   *  Our image on the left should be a radial progress indicator, clockwise
   */
    CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathBlock));
    left->setType(kCCProgressTimerTypeRadial);
    addChild(left);
    left->setMidpoint(ccp(0.25f, 0.75f));
    left->setPosition(ccp(100, s.height/2));
    left->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease()));

    /**
   *  Our image on the left should be a radial progress indicator, counter clockwise
   */
    CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathBlock));
    right->setType(kCCProgressTimerTypeRadial);
    right->setMidpoint(ccp(0.75f, 0.25f));

    /**
   *  Note the reverse property (default=NO) is only added to the right image. That's how
   *  we get a counter clockwise progress.
   */
    addChild(right);
    right->setPosition(ccp(s.width-100, s.height/2));
    right->runAction(CCRepeatForever::create((CCActionInterval *)action->copy()->autorelease()));
}
예제 #2
0
//------------------------------------------------------------------
//
// SpriteProgressToVertical
//
//------------------------------------------------------------------
void SpriteProgressToVertical::onEnter()
{
    SpriteDemo::onEnter();
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();
    
    CCProgressTo *to1 = CCProgressTo::create(2, 100);
    CCProgressTo *to2 = CCProgressTo::create(2, 100);
    
    CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
    left->setType(kCCProgressTimerTypeBar);

    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    left->setMidpoint(ccp(0,0));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    left->setBarChangeRate(ccp(0, 1));
    addChild(left);
    left->setPosition(CCPointMake(100, s.height/2));
    left->runAction( CCRepeatForever::create(to1));
    
    CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
    right->setType(kCCProgressTimerTypeBar);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    right->setMidpoint(ccp(0, 1));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    right->setBarChangeRate(ccp(0, 1));
    addChild(right);
    right->setPosition(CCPointMake(s.width-100, s.height/2));
    right->runAction( CCRepeatForever::create(to2));
}
예제 #3
0
void SpriteProgressToHorizontal::onEnter()
{
    SpriteDemo::onEnter();
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();
    
    CCProgressTo *to1 = CCProgressTo::create(2, 100);
    CCProgressTo *to2 = CCProgressTo::create(2, 100);
    
    CCProgressTimer *left = CCProgressTimer::progressWithFile(s_pPathSister1);
    left->setType(kCCProgressTimerTypeHorizontalBarLR);
    //    Setup for a bar starting from the left since the midpoint is 0 for the x
    left->setMidpoint(ccp(0,0));
    //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
    left->setBarChangeRate(ccp(1, 0));
    addChild(left);
    left->setPosition(ccp(100, s.height/2));
    left->runAction( CCRepeatForever::create(to1));
    
    CCProgressTimer *right = CCProgressTimer::progressWithFile(s_pPathSister2);
    right->setType(kCCProgressTimerTypeHorizontalBarRL);
    //    Setup for a bar starting from the left since the midpoint is 1 for the x
    right->setMidpoint(ccp(1, 0));
    //    Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
    right->setBarChangeRate(ccp(1, 0));
    addChild(right);
    right->setPosition(ccp(s.width-100, s.height/2));
    right->runAction( CCRepeatForever::create(to2));
}
예제 #4
0
bool LoadingLayer::setUpdateView()
{
    bool isRet = false;
    do{
	CCSprite* loadingbackimg = CCSprite::create("gmbg/loadingbg.png");
	CC_BREAK_IF(!loadingbackimg);
	loadingbackimg->setPosition(ccp(getWinSize().width/2 + getWinOrigin().x, getWinSize().height/5 + getWinOrigin().y));
	this->addChild(loadingbackimg, 1);

	CCSprite* loadimg = CCSprite::create("gmbg/loading.png");
	CC_BREAK_IF(!loadimg);
	CCProgressTimer* pt = CCProgressTimer::create(loadimg);
	pt->setType(cocos2d::CCProgressTimerType(kCCProgressTimerTypeBar));
	pt->setMidpoint(ccp(0,0.5));
	pt->setBarChangeRate(ccp(1,0));
	float tex = getWinSize().width/2 + getWinOrigin().x;
	float tey = getWinSize().height/5 + getWinOrigin().y-5;
	pt->setPosition(ccp(tex, tey));
	pt->setPercentage(0);
	this->addChild(pt, 2, 1);
	CCProgressTo* to = CCProgressTo::create(5, 100);
	pt->runAction(CCRepeatForever::create(to));
	isRet = true;
	
    }while(0);
    return isRet;
}
예제 #5
0
//******************************************************************************
// skillDecCD
//******************************************************************************
void Card::skillDecCD(int cd)
{
    CCSprite* spWhite = CCSprite::spriteWithFile("headw.png");
    if (spWhite) {
        addChild(spWhite, 2, kToBeDeleteTag);
        spWhite->setPositionInPixels(CCPointMake(55 + 106*m_idx, 615));
        spWhite->setIsVisible(false);
        spWhite->runAction(CCSequence::actions(CCDelayTime::actionWithDuration(0.7),
                                               CCShow::action(),
                                               CCFadeIn::actionWithDuration(0.15),
                                               CCFadeOut::actionWithDuration(0.15),
                                               CCCallFunc::actionWithTarget(this, callfunc_selector(Card::delUnusedObj)),
                                               NULL));
        
        CCProgressTimer* tmOrange = CCProgressTimer::progressWithFile("heado.png");
        if (tmOrange) {
            addChild(tmOrange, 2, kToBeDeleteTag);
            tmOrange->setPositionInPixels(CCPointMake(55 + 106*m_idx, 615));
            tmOrange->setType(kCCProgressTimerTypeRadialCCW);
            tmOrange->setPercentage(99);
            tmOrange->runAction(CCProgressTo::actionWithDuration(0.7, 0));
        }
    }
    
    m_iSklCdDwn = cd;
    m_iCurSkillCD = MIN(m_iCurSkillCD.get(), (m_iSkillCDMax - m_iSklCdDwn));
}
예제 #6
0
void ControllPanel::makeSkillCD(CCObject *pSender)
{
	CCLog("makeSkillCD");
	//进入CD状态
	this->setMagicCD(true);
	//设置按钮不可用
	m_pMagicItem->setIsEnabled(false);

	//创建技能cd样式
	CCProgressTimer *cd = CCProgressTimer::progressWithFile("actor_btn_mask.png");
	cd->setType(kCCProgressTimerTypeRadialCCW);
	cd->setPosition(m_pMagicItem->getParent()->getPosition());
	cd->setPercentage(99.99f);
	this->addChild(cd, 1000);
	//技能冷却动画
	CCProgressTo *to = CCProgressTo::actionWithDuration(PlayerMrg::getInstance()->getPlayer()->getPlayerSkillCd(), 0);
	//冷却完成之后的回调,销毁对象,同时使技能按钮可用
	CCCallFuncND *callfunn = CCCallFuncND::actionWithTarget(this, callfuncND_selector(ControllPanel::endSkillCD), (void*)cd);
	 
	cd->runAction(CCSequence::actions(to, callfunn, NULL));

	m_lMagicCDLabel->setIsVisible(true);
	schedule(schedule_selector(ControllPanel::updateCountDown), 1.0f);

}
예제 #7
0
void ASBot::changeEnergyBarAnimation(int _dif){
    
    CCProgressTimer* energyBar = (CCProgressTimer*)this->getChildByTag(2*10000000+20);
    int percentage = energyBar->getPercentage();
    
    CCProgressFromTo* action = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight);
    CCSequence* seq = CCSequence::create(action,NULL);
    energyBar->runAction(seq);
}
예제 #8
0
//进度动作  
void HelloWorld::JDCallback(CCObject* pSender)  
{  
    CCProgressTo *to1 = CCProgressTo::actionWithDuration(2,100); 
	CCSprite *jl=CCSprite::spriteWithFile("jl.png");

    CCProgressTimer *left = CCProgressTimer::progressWithSprite(jl);  
    left->setType(kCCProgressTimerTypeBar);  
    addChild(left);  
    left->setPosition(CCPointMake(100,s.height/2));  
    left->runAction(CCRepeatForever::actionWithAction(to1));  
}  
예제 #9
0
//------------------------------------------------------------------
//
// SpriteProgressToVertical
//
//------------------------------------------------------------------
void SpriteProgressToVertical::onEnter()
{
	SpriteDemo::onEnter();
	
	CCSize s = CCDirector::sharedDirector()->getWinSize();
	
	CCProgressTo *to1 = CCProgressTo::actionWithDuration(2, 100);
	CCProgressTo *to2 = CCProgressTo::actionWithDuration(2, 100);
	
	CCProgressTimer *left = CCProgressTimer::progressWithFile(s_pPathSister1);
	left->setType( kCCProgressTimerTypeVerticalBarBT );
	addChild(left);
	left->setPosition(CCPointMake(100, s.height/2));
	left->runAction( CCRepeatForever::actionWithAction(to1));
	
	CCProgressTimer *right = CCProgressTimer::progressWithFile(s_pPathSister2);
	right->setType( kCCProgressTimerTypeVerticalBarTB );
	addChild(right);
	right->setPosition(CCPointMake(s.width-100, s.height/2));
	right->runAction( CCRepeatForever::actionWithAction(to2));
}
예제 #10
0
//------------------------------------------------------------------
//
// SpriteProgressWithSpriteFrame
//
//------------------------------------------------------------------
void SpriteProgressWithSpriteFrame::onEnter()
{
    SpriteDemo::onEnter();

    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCProgressTo *to = CCProgressTo::create(6, 100);

    CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("zwoptex/grossini.plist");

    CCProgressTimer *left = CCProgressTimer::create(CCSprite::createWithSpriteFrameName("grossini_dance_01.png"));
    left->setType(kCCProgressTimerTypeBar);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    left->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    left->setBarChangeRate(ccp(1, 0));
    addChild(left);
    left->setPosition(ccp(100, s.height/2));
    left->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));

    CCProgressTimer *middle = CCProgressTimer::create(CCSprite::createWithSpriteFrameName("grossini_dance_02.png"));
    middle->setType(kCCProgressTimerTypeBar);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    middle->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    middle->setBarChangeRate(ccp(1, 1));
    addChild(middle);
    middle->setPosition(ccp(s.width/2, s.height/2));
    middle->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));

    CCProgressTimer *right = CCProgressTimer::create(CCSprite::createWithSpriteFrameName("grossini_dance_03.png"));
    right->setType(kCCProgressTimerTypeRadial);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    right->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    right->setBarChangeRate(ccp(0, 1));
    addChild(right);
    right->setPosition(ccp(s.width-100, s.height/2));
    right->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
}
예제 #11
0
void CCTransitionRadialCCW::onEnter()
{
	CCTransitionScene::onEnter();
	// create a transparent color layer
	// in which we are going to add our rendertextures
	CCSize size = CCDirector::sharedDirector()->getWinSize();

	// create the second render texture for outScene
	m_OutRT = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);

	if (NULL == m_OutRT)
		return;
	
	m_OutRT->retain();

	m_OutRT->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
	m_OutRT->setPosition(ccp(size.width/2, size.height/2));
	m_OutRT->setAnchorPoint(ccp(0.5f,0.5f));

	//	We need the texture in RenderTexture.
	CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(m_OutRT->getSprite()->getTexture());
	// but it's flipped upside down so we flip the sprite
	outNode->getSprite()->setFlipY(true);

	// fix content scale factor for radial texture
	CCRect rect = CCRectZero;
	rect.size = m_OutRT->getSprite()->getTexture()->getContentSize();
	outNode->getSprite()->setTextureRect(rect, false);
	float scale = 1.0f / CC_CONTENT_SCALE_FACTOR();
	rect.size.width *= scale;
	rect.size.height *= scale;
	outNode->setContentSize(rect.size);

	//	Return the radial type that we want to use
	outNode->setType(radialType());
	outNode->setPercentage(100.f);
	outNode->setPosition(ccp(size.width/2, size.height/2));
	outNode->setAnchorPoint(ccp(0.5f,0.5f));

	// create the blend action
	CCAction * layerAction = CCSequence::actions
	(
		CCProgressFromTo::actionWithDuration(m_fDuration, 100.0f, 0.0f),
		CCEventCall::actionWithTarget(NULL, createEventHandler(this, &CCTransitionScene::_finish)),
		NULL
	);
	// run the blend action
	outNode->runAction(layerAction);

	// add the layer (which contains our two rendertextures) to the scene
	this->addChild(outNode, 2, kSceneRadial);
}
예제 #12
0
//------------------------------------------------------------------
//
// SpriteProgressBarVarious
//
//------------------------------------------------------------------
void SpriteProgressBarVarious::onEnter()
{
    SpriteDemo::onEnter();

    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCProgressTo *to = CCProgressTo::create(2, 100);

    CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
    left->setType(kCCProgressTimerTypeBar);

    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    left->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    left->setBarChangeRate(ccp(1, 0));
    addChild(left);
    left->setPosition(ccp(100, s.height/2));
    left->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));

    CCProgressTimer *middle = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
    middle->setType(kCCProgressTimerTypeBar);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    middle->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    middle->setBarChangeRate(ccp(1,1));
    addChild(middle);
    middle->setPosition(ccp(s.width/2, s.height/2));
    middle->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));

    CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
    right->setType(kCCProgressTimerTypeBar);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    right->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    right->setBarChangeRate(ccp(0, 1));
    addChild(right);
    right->setPosition(ccp(s.width-100, s.height/2));
    right->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
}
예제 #13
0
void CCTransitionRadialCCW::onEnter()
{
	CCTransitionScene::onEnter();
	// create a transparent color layer
	// in which we are going to add our rendertextures
	CCSize size = CCDirector::sharedDirector()->getWinSize();

	// create the second render texture for outScene
	CCRenderTexture *outTexture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);

	if (NULL == outTexture)
	{
		return;
	}
	
	outTexture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
	outTexture->setPosition(ccp(size.width/2, size.height/2));
	outTexture->setAnchorPoint(ccp(0.5f,0.5f));

	// render outScene to its texturebuffer
	outTexture->clear(0,0,0,1);
	outTexture->begin();
	m_pOutScene->visit();
	outTexture->end();

	//	Since we've passed the outScene to the texture we don't need it.
	this->hideOutShowIn();

	//	We need the texture in RenderTexture.
	CCProgressTimer *outNode = CCProgressTimer::progressWithTexture(outTexture->getSprite()->getTexture());
	// but it's flipped upside down so we flip the sprite
	outNode->getSprite()->setFlipY(true);
	//	Return the radial type that we want to use
	outNode->setType(radialType());
	outNode->setPercentage(100.f);
	outNode->setPosition(ccp(size.width/2, size.height/2));
	outNode->setAnchorPoint(ccp(0.5f,0.5f));

	// create the blend action
	CCAction * layerAction = CCSequence::actions
	(
		CCProgressFromTo::actionWithDuration(m_fDuration, 100.0f, 0.0f),
		CCCallFunc::actionWithTarget(this, callfunc_selector(CCTransitionScene::finish)),
		NULL
	);
	// run the blend action
	outNode->runAction(layerAction);

	// add the layer (which contains our two rendertextures) to the scene
	this->addChild(outNode, 2, kSceneRadial);
}
예제 #14
0
void ASGame::changeEnergyBarAnimation(int _dif){
    
    CCProgressTimer* energyBar = (CCProgressTimer*)this->getChildByTag(playerNumber*10000000+20);
    CCProgressTimer* attackButton = (CCProgressTimer*)this->getChildByTag(1*10000000+25);
    int percentage = energyBar->getPercentage();

    //1.上方行动力槽
    CCProgressFromTo* action = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight);
    energyBar->runAction(action);

    //2.下方攻击按钮槽
    CCProgressFromTo* action1 = CCProgressFromTo::create(0.015*(abs(moveCount*100/moveToFight-percentage)), percentage, moveCount*100/moveToFight);
    attackButton->runAction(action1);
    
    //3.能量条盖子
    /*
     CCSprite* energyBarCover = (CCSprite*)this->getChildByTag(player 28);
     energyBarCover->setOpacity(255);
     float tmpScale = (sqrt(pow(107, 2) - pow((abs((int)(107-_pixel))),2))*2)/214;
     energyBarCover->setScale(tmpScale);
     energyBarCover->setPosition(ccp(size.width*179/200, size.height/13.5 - (215-_pixel)/2*tmpScale));
     */
}
예제 #15
0
//------------------------------------------------------------------
//
// SpriteProgressToRadial
//
//------------------------------------------------------------------
void SpriteProgressToRadial::onEnter()
{
    SpriteDemo::onEnter();
    
    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCProgressTo *to1 = CCProgressTo::create(2, 100);
    CCProgressTo *to2 = CCProgressTo::create(2, 100);

    CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
    left->setType( kCCProgressTimerTypeRadial );
    addChild(left);
    left->setPosition(CCPointMake(100, s.height/2));
    left->runAction( CCRepeatForever::create(to1));
    
    CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathBlock));
    right->setType(kCCProgressTimerTypeRadial);
    // Makes the ridial CCW
    right->setReverseProgress(true);
    addChild(right);
    right->setPosition(CCPointMake(s.width-100, s.height/2));
    right->runAction( CCRepeatForever::create(to2));
}
예제 #16
0
//------------------------------------------------------------------
//
// SpriteProgressBarTintAndFade
//
//------------------------------------------------------------------
void SpriteProgressBarTintAndFade::onEnter()
{
    SpriteDemo::onEnter();

    CCSize s = CCDirector::sharedDirector()->getWinSize();

    CCProgressTo *to = CCProgressTo::create(6, 100);
    CCAction *tint = CCSequence::create(CCTintTo::create(1, 255, 0, 0),
                                         CCTintTo::create(1, 0, 255, 0),
                                         CCTintTo::create(1, 0, 0, 255),
                                         NULL);
    CCAction *fade = CCSequence::create(CCFadeTo::create(1.0f, 0),
                                         CCFadeTo::create(1.0f, 255),
                                         NULL);

    CCProgressTimer *left = CCProgressTimer::create(CCSprite::create(s_pPathSister1));
    left->setType(kCCProgressTimerTypeBar);

    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    left->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    left->setBarChangeRate(ccp(1, 0));
    addChild(left);
    left->setPosition(ccp(100, s.height/2));
    left->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
    left->runAction(CCRepeatForever::create((CCActionInterval *)tint->copy()->autorelease()));

    left->addChild(CCLabelTTF::create("Tint", "Marker Felt", 20.0f));

    CCProgressTimer *middle = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
    middle->setType(kCCProgressTimerTypeBar);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    middle->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    middle->setBarChangeRate(ccp(1, 1));
    addChild(middle);
    middle->setPosition(ccp(s.width/2, s.height/2));
    middle->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
    middle->runAction(CCRepeatForever::create((CCActionInterval *)fade->copy()->autorelease()));

    middle->addChild(CCLabelTTF::create("Fade", "Marker Felt", 20.0f));

    CCProgressTimer *right = CCProgressTimer::create(CCSprite::create(s_pPathSister2));
    right->setType(kCCProgressTimerTypeBar);
    //    Setup for a bar starting from the bottom since the midpoint is 0 for the y
    right->setMidpoint(ccp(0.5f, 0.5f));
    //    Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
    right->setBarChangeRate(ccp(0, 1));
    addChild(right);
    right->setPosition(ccp(s.width-100, s.height/2));
    right->runAction(CCRepeatForever::create((CCActionInterval *)to->copy()->autorelease()));
    right->runAction(CCRepeatForever::create((CCActionInterval *)tint->copy()->autorelease()));
    right->runAction(CCRepeatForever::create((CCActionInterval *)fade->copy()->autorelease()));

    right->addChild(CCLabelTTF::create("Tint and Fade", "Marker Felt", 20.0f));
}
예제 #17
0
void
MCSkillBarItem::intoColdTime()
{
    CCSprite *coldSprite = CCSprite::create(kMCColdTimeSkillIconFilepath);
    CCProgressTimer *progressTimer = CCProgressTimer::create(coldSprite);
    
    progressTimer->setReverseProgress(true);
    progressTimer->setAnchorPoint(CCPointZero);
    addChild(progressTimer);
    
    setOpacity(kMCSkillBarItemColdTimeOpacity);
    progressTimer->runAction(CCSequence::createWithTwoActions(CCProgressFromTo::create(skill_->coldTime, 100.f, 0.0f),
                                                              CCCallFuncO::create(this,
                                                                                  callfuncO_selector(MCSkillBarItem::coldTimeDidFinish),
                                                                                  progressTimer)));
}
예제 #18
0
void ASGame::changeHeart(int _shengming,int _source){
    
    shengming += _shengming;
    if (shengming<=0)
        shengming = 0;
    
    //1.血条
    CCProgressTimer* heartBar = (CCProgressTimer*)this->getChildByTag(1*10000000+2222);
    CCProgressFromTo* action = CCProgressFromTo::create(0.5, heartBar->getPercentage(), (float)shengming/(float)maxShengMing*100);
    heartBar->runAction(action);
    if ((float)shengming <= 0.4*(float)maxShengMing){
        heartBar->getSprite()->setColor(ccc3(237, 45, 37));
        
        if(!MainUser->muted){
            CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect(heartSoundEffect);
            heartSoundEffect = CocosDenshion::SimpleAudioEngine::sharedEngine()->playEffect("noHeart.wav", true);
        }
    }else{
        heartBar->getSprite()->setColor(ccc3(255, 255, 255));
        if(!MainUser->muted)
            CocosDenshion::SimpleAudioEngine::sharedEngine()->stopEffect(heartSoundEffect);
    }
    
    //2.生命数字
    string HeartStr = int2string(shengming)  + "/" + int2string(maxShengMing);
    CCLabelTTF* heartLabel = (CCLabelTTF*)this->getChildByTag(playerNumber*10000000+2223);
    heartLabel->setString(HeartStr.c_str());

    //3.判断胜利条件
    if (shengming == 0 && !((GameBaseClass*)getParent())->gameover){
        ((GameBaseClass*)getParent())->gameover = true;
        //1.禁用各种按钮
        CCMenu* skillMenu = (CCMenu*)this->getChildByTag(1*10000000+27);
        CCMenu* optionMenu = (CCMenu*)this->getChildByTag(1*10000000+12);
        CCMenu* itemMenu = (CCMenu*)this->getChildByTag(1*10000000+77776);
        skillMenu->setTouchEnabled(false);
        optionMenu->setTouchEnabled(false);
        itemMenu->setTouchEnabled(false);
        
        //2.停止所有监听
        unscheduleAllSelectors();
        bot2->unscheduleAllSelectors();
        
        //3.结束页面
        ((GameBaseClass*)getParent())->GameResult(1);
    }
}
// CCTransitionProgress
void CCTransitionProgress::onEnter()
{
    CCTransitionScene::onEnter();

    setupTransition();
    
    // create a transparent color layer
    // in which we are going to add our rendertextures
    CCSize size = CCDirector::sharedDirector()->getWinSize();

    // create the second render texture for outScene
    CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
    texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
    texture->setPosition(ccp(size.width/2, size.height/2));
    texture->setAnchorPoint(ccp(0.5f,0.5f));

    // render outScene to its texturebuffer
    texture->clear(0, 0, 0, 1);
    texture->begin();
    m_pSceneToBeModified->visit();
    texture->end();


    //    Since we've passed the outScene to the texture we don't need it.
    if (m_pSceneToBeModified == m_pOutScene)
    {
        hideOutShowIn();
    }
    //    We need the texture in RenderTexture.
    CCProgressTimer *pNode = progressTimerNodeWithRenderTexture(texture);

    // create the blend action
    CCActionInterval* layerAction = (CCActionInterval*)CCSequence::create(
        CCProgressFromTo::create(m_fDuration, m_fFrom, m_fTo),
        CCCallFunc::create(this, callfunc_selector(CCTransitionProgress::finish)), 
        NULL);
    // run the blend action
    pNode->runAction(layerAction);

    // add the layer (which contains our two rendertextures) to the scene
    addChild(pNode, 2, kCCSceneRadial);
}
예제 #20
0
void OptionLayer::skillCoolHandler(CCObject* pSender)
{
    OptionLayer *optionLayer = global->optionLayer;
    UIImageView* skillView = (UIImageView*)pSender;
    global->hero->setAllowMove(false);//动画执行期间角色不可移动
    float SumCD = 10.0f;
    //判断指向对象是否相等来初始化cd时间
    if(optionLayer->getSkill_attack_1() == skillView){
        SumCD = optionLayer->skill_SumCD_1;
        global->hero->RunAttackAction_1();		//执行特殊攻击1动画
    }else if(optionLayer->getSkill_attack_2() == skillView){
        SumCD = optionLayer->skill_SumCD_2;
    }else if(optionLayer->getSkill_attack_3() == skillView){
        SumCD = optionLayer->skill_SumCD_3;
    }else if(optionLayer->getSkill_attack() == skillView){
        SumCD = optionLayer->skill_SumCD_0;
        global->hero->RunAttackAction();		//执行普通攻击动画
    }else if(optionLayer->getBlood_bottle() == skillView){
        SumCD = optionLayer->blood_SumCD;
    }else if(optionLayer->getMagic_bottle() == skillView){
        SumCD = optionLayer->magic_SumCD;
    }
    skillView->setTouchEnabled(false);		//CD开始,禁止本技能使用
    //初始化 cd遮罩
    CCTexture2D *spriteTx = CCTextureCache::sharedTextureCache()->addImage("Skill_UI/cooling_cover.png");
    CCSprite * SkillCover = CCSprite::createWithTexture(spriteTx);
    CCProgressTimer *skillTimer  = CCProgressTimer::create(SkillCover);
    skillTimer->setOpacity(125);							//透明度
    skillTimer->setPosition(skillView->getPosition());//将进度遮罩设置在技能图标位置上
    optionLayer->getSkillUI()->addChild(skillTimer);
    
    skillTimer->setType(kCCProgressTimerTypeRadial);//扇形
    skillTimer->setPercentage(100);
    skillTimer->setReverseProgress(true);
    
    CCProgressTo* cdAction=CCProgressTo::create(SumCD, 100);
    CCCallFuncND* func=CCCallFuncND::create(this, callfuncND_selector(OptionLayer::allowToClick),skillView);//附带skillView参数 方便cd结束后处理
    CCFiniteTimeAction* seq=CCSequence::create(cdAction,func,NULL);
    skillTimer->runAction(seq);
}
예제 #21
0
void CNFRockerLayer::update( float delta )
{
	do 
	{
		//得到主角
		CNFProtagonist * pPro = dynamic_cast<CNFProtagonist *>(m_p3DLayer->getChildByTag(enTagProtagonist));
		if (pPro!=NULL)
		{
			//得到摇杆
			CCSprite * pRockerBg = dynamic_cast<CCSprite *>(getChildByTag(enTagRockerBg));
			CC_BREAK_IF(pRockerBg==NULL);
			CCSprite * pRocker = dynamic_cast<CCSprite *>(getChildByTag(enTagRocker));
			CC_BREAK_IF(pRocker==NULL);

			//若正在触摸
			if (m_bIsTouching==true)
			{
				pRocker->setOpacity(255.f);
				pRockerBg->setOpacity(255.f);

				//触摸点与摇杆背景的距离
				float fRockerDisX = m_ptTouching.x - pRockerBg->getPositionX();
				float fRockerDisY = m_ptTouching.y - pRockerBg->getPositionY();
				float fLen = sqrt(pow(fRockerDisX,2)+pow(fRockerDisY,2));

				//触摸点与摇杆背景的角度
				float fRate = (float)CC_RADIANS_TO_DEGREES( atanf(fRockerDisX/fRockerDisY) );
				if(fRockerDisY<0)			fRate += 180.f;
				else if(fRockerDisX<0)		fRate += 360.f;

				//触摸点的实际位置
				CCPoint ptRockerMoveTo;
				if (fLen >= m_fRockerMaxDis)		fLen = m_fRockerMaxDis;
				ptRockerMoveTo.x = sin(fRate/180*3.1415)*fLen + pRockerBg->getPositionX();		
				ptRockerMoveTo.y = cos(fRate/180*3.1415)*fLen + pRockerBg->getPositionY();

				//触摸点与摇杆的距离
				float fDisX = ptRockerMoveTo.x - pRocker->getPositionX();
				float fDisY = ptRockerMoveTo.y - pRocker->getPositionY();
				float fLength = sqrt(pow(fDisX,2)+pow(fDisY,2));

				//出发每次移动的条件:距离至少大于速度。	防止颤动
				if (fLength > m_fRockerSpeed)
				{   
					//触摸点与摇杆的角度
					float fRateRocker = (float)CC_RADIANS_TO_DEGREES( atanf(fDisX/fDisY) );
					if(fDisY<0)				fRateRocker += 180.f;
					else if(fDisX<0)		fRateRocker += 360.f;

					ptRockerMoveTo.x = sin(fRateRocker/180*3.1415)*m_fRockerSpeed + pRocker->getPositionX();		
					ptRockerMoveTo.y = cos(fRateRocker/180*3.1415)*m_fRockerSpeed + pRocker->getPositionY();

					pRocker->setPosition(ptRockerMoveTo);
				}
				else	//距离小于速度,则直接命中
				{
					pRocker->setPosition(ptRockerMoveTo);
				}

				//主角移动
				pPro->OnCtrlMoveByRotation(fRate);

			}
			//若触摸结束
			else 
			{
				pRocker->setOpacity(100.f);
				pRockerBg->setOpacity(100.f);

				pPro->OnCtrlStop();

				//移动距离
				float fDisX = pRockerBg->getPositionX() - pRocker->getPositionX();
				float fDisY = pRockerBg->getPositionY() - pRocker->getPositionY();
				float fLen = sqrt(pow(fDisX,2)+pow(fDisY,2));

				//若距离大于速度,则移动
				if (fLen > m_fRockerSpeed)
				{  
					float at = (float)CC_RADIANS_TO_DEGREES( atanf(fDisX/fDisY) );
					if(fDisY<0)			at += 180.f;
					else if(fDisX<0)	at += 360.f;

					CCPoint ptRockerMoveTo;
					ptRockerMoveTo.x = sin(at/180*3.1415)*m_fRockerSpeed + pRocker->getPositionX();		
					ptRockerMoveTo.y = cos(at/180*3.1415)*m_fRockerSpeed + pRocker->getPositionY();
					pRocker->setPosition(ptRockerMoveTo);
				}
				else //若距离小雨速度,则直接命中
				{
					pRocker->setPosition(pRockerBg->getPosition());
				}			
			}

			//若为副本,则执行按钮逻辑
			if (m_nStageID >= _NF_TOWN_OR_BATTLE_ID_ && m_nStageID <_NF_TOWN_FB_ID_)
			{
				//得到菜单
				CCMenu * pMenu = dynamic_cast<CCMenu *>(getChildByTag(enTagMenu));
				CC_BREAK_IF(pMenu==NULL);

				//遍历按钮,同步CD
				for (int i=enTagBtnSkill1;i<=enTagBtnSkill5;i++)
				{
					//技能CD
					CCProgressTimer* pProgress = dynamic_cast<CCProgressTimer *>(getChildByTag(i+100));
					CC_BREAK_IF(pProgress==NULL);

					//得到按钮
					CCMenuItemSprite * pBtn = dynamic_cast<CCMenuItemSprite *>(pMenu->getChildByTag(i));
					CC_BREAK_IF(pBtn==NULL);

					switch (i)
					{
					case enTagBtnSkill1:
						{
							//同步技能CD
							pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_1().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_1().nSkill_CD_Time );

							//判断按钮是否可按				
							if (pPro->GetSkillInfo_1().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false)	pBtn->setEnabled(true);				
							else	pBtn->setEnabled(false);
						}break;
					case enTagBtnSkill2:
						{
							pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_2().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_2().nSkill_CD_Time );	
							if (pPro->GetSkillInfo_2().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false)	pBtn->setEnabled(true);
							else	pBtn->setEnabled(false);
						}break;
					case enTagBtnSkill3:
						{
							pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_3().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_3().nSkill_CD_Time );			
							if (pPro->GetSkillInfo_3().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false)	pBtn->setEnabled(true);
							else	pBtn->setEnabled(false);
						}break;
					case enTagBtnSkill4:
						{
							pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_4().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_4().nSkill_CD_Time );			
							if (pPro->GetSkillInfo_4().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false)	pBtn->setEnabled(true);
							else	pBtn->setEnabled(false);
						}break;
					case enTagBtnSkill5:
						{
							pProgress->setPercentage( 100*(float)pPro->GetSkillInfo_5().nSkill_CD_Time_Temp/(float)pPro->GetSkillInfo_5().nSkill_CD_Time );			
							if (pPro->GetSkillInfo_5().nSkill_CD_Time_Temp == 0 && m_bIsPublicCD==false)	
								pBtn->setEnabled(true);
							else	
								pBtn->setEnabled(false);
						}break;
					}		
				}

				CCProgressTimer* pProgressCom = dynamic_cast<CCProgressTimer *>(getChildByTag(enTagCommonAttackCD));
				if(pProgressCom!=NULL){
					pProgressCom->setPercentage( 100*pPro->GetCommonAttackCDBFB());
				}

				CCLabelBMFont* pComonFont = dynamic_cast<CCLabelBMFont *>(getChildByTag(enTagCommonAttackFont));
				if(pComonFont!=NULL){
					if(pPro->GetCommonAttackStatus()!=0){
						pComonFont->setString(CCString::createWithFormat("%d",pPro->GetCommonAttackStatus())->m_sString.c_str());
					}
				}


				//判断是否有技能刚释放
				bool bIsSkillStart = false;
				if (pPro->GetSkillInfo_1().nSkill_CD_Time_Temp==pPro->GetSkillInfo_1().nSkill_CD_Time-1)	bIsSkillStart = true;
				if (pPro->GetSkillInfo_2().nSkill_CD_Time_Temp==pPro->GetSkillInfo_2().nSkill_CD_Time-1)	bIsSkillStart = true;
				if (pPro->GetSkillInfo_3().nSkill_CD_Time_Temp==pPro->GetSkillInfo_3().nSkill_CD_Time-1)	bIsSkillStart = true;
				if (pPro->GetSkillInfo_4().nSkill_CD_Time_Temp==pPro->GetSkillInfo_4().nSkill_CD_Time-1)	bIsSkillStart = true;
				if (pPro->GetSkillInfo_5().nSkill_CD_Time_Temp==pPro->GetSkillInfo_5().nSkill_CD_Time-1)	bIsSkillStart = true;

				//若有技能刚释放
				if (bIsSkillStart==true)
				{
					m_bIsPublicCD = true;
					this->runAction(CCSequence::create(CCDelayTime::create(1.f),CCCallFunc::create(this,callfunc_selector(CNFRockerLayer::OnSkillPublicCallBack)),NULL));

					for (int i=enTagBtnSkill1;i<=enTagBtnSkill5;i++)
					{	
						//判断是否显示公共CD
						bool bIsSkillPublicCD = false;

						if (i==enTagBtnSkill1 && pPro->GetSkillInfo_1().nSkill_CD_Time_Temp==0)			bIsSkillPublicCD = true;
						else if (i==enTagBtnSkill2 && pPro->GetSkillInfo_2().nSkill_CD_Time_Temp==0)	bIsSkillPublicCD = true;					
						else if (i==enTagBtnSkill3 && pPro->GetSkillInfo_3().nSkill_CD_Time_Temp==0)	bIsSkillPublicCD = true;
						else if (i==enTagBtnSkill4 && pPro->GetSkillInfo_4().nSkill_CD_Time_Temp==0)	bIsSkillPublicCD = true;
						else if (i==enTagBtnSkill5 && pPro->GetSkillInfo_5().nSkill_CD_Time_Temp==0)	bIsSkillPublicCD = true;

						//若显示公共CD
						if (bIsSkillPublicCD==true)
						{
							//显示公共CD
							CCProgressTimer* pProgress = dynamic_cast<CCProgressTimer *>(getChildByTag(i+200));
							CC_BREAK_IF(pProgress==NULL);
							pProgress->setVisible(true);
							pProgress->setPercentage(99.f);	
							pProgress->runAction(CCSequence::create(CCProgressTo::create(_NF_PUBLIC_SKILL_CD_,0),NULL));	
						}
					}
				}
			}
		}

		return ;
	} while (false);
	CCLog("Fun CNFRockerLayer::update Error!");
}
예제 #22
0
파일: game_bj.cpp 프로젝트: nodephp/fly
//碰撞检测
void game_bj::auto_pz(char id)
{
    CCSprite *sprinte_11 = (CCSprite*)getChildByTag(11);
    CCSprite *sprinte_12 = (CCSprite*)getChildByTag(12);
    CCSprite *sprinte_13 = (CCSprite*)getChildByTag(13);
    CCSprite *sprinte_14 = (CCSprite*)getChildByTag(14);
    CCSprite *sprinte_15 = (CCSprite*)getChildByTag(15);

    CCSprite *sprinte_11_a = (CCSprite*)getChildByTag(21);
    CCSprite *sprinte_12_a = (CCSprite*)getChildByTag(22);
    CCSprite *sprinte_13_a = (CCSprite*)getChildByTag(23);
    CCSprite *sprinte_14_a = (CCSprite*)getChildByTag(24);
    CCSprite *sprinte_15_a = (CCSprite*)getChildByTag(25);

    CCSprite *sprinte_11_b = (CCSprite*)getChildByTag(31);
    CCSprite *sprinte_12_b = (CCSprite*)getChildByTag(32);
    CCSprite *sprinte_13_b = (CCSprite*)getChildByTag(33);
    CCSprite *sprinte_14_b = (CCSprite*)getChildByTag(34);
    CCSprite *sprinte_15_b = (CCSprite*)getChildByTag(35);

    CCSprite *sprinte_11_y_a = (CCSprite*)getChildByTag(41);
    CCSprite *sprinte_12_y_a = (CCSprite*)getChildByTag(42);
    CCSprite *sprinte_13_y_a = (CCSprite*)getChildByTag(43);
    CCSprite *sprinte_14_y_a = (CCSprite*)getChildByTag(44);
    CCSprite *sprinte_15_y_a = (CCSprite*)getChildByTag(45);

    CCSprite *sprinte_11_y_b = (CCSprite*)getChildByTag(51);
    CCSprite *sprinte_12_y_b = (CCSprite*)getChildByTag(52);
    CCSprite *sprinte_13_y_b = (CCSprite*)getChildByTag(53);
    CCSprite *sprinte_14_y_b = (CCSprite*)getChildByTag(54);
    CCSprite *sprinte_15_y_b = (CCSprite*)getChildByTag(55);

    for (int ii = 101; ii<=112; ii++)
    {
        CCSprite *sprinte_xxx = (CCSprite*)getChildByTag(ii);
        if(sprinte_xxx)
        {
//        CCLOG("44");
            bool ret_1 = false;
            bool ret_2 = false;
            bool ret_3 = false;
            bool ret_4 = false;
            bool ret_5 = false;

            if(sprinte_11)
            {
                ret_1 = CCRect::CCRectIntersectsRect(sprinte_xxx->boundingBox(), sprinte_11->boundingBox());
            }

            if(sprinte_12)
            {
                ret_2 = CCRect::CCRectIntersectsRect(sprinte_xxx->boundingBox(), sprinte_12->boundingBox());
            }

            if(sprinte_13)
            {
                ret_3 = CCRect::CCRectIntersectsRect(sprinte_xxx->boundingBox(), sprinte_13->boundingBox());
            }

            if(sprinte_14)
            {
                ret_4 = CCRect::CCRectIntersectsRect(sprinte_xxx->boundingBox(), sprinte_14->boundingBox());
            }

            if(sprinte_15)
            {
                ret_5 = CCRect::CCRectIntersectsRect(sprinte_xxx->boundingBox(), sprinte_15->boundingBox());
            }

            if(ret_1)
            {
                CCPoint point = sprinte_11->getPosition();
//            CCLOG("1");
//            this->removeChild(sprinte_11, true);
//            this->removeChild(sprinte_11_a, true);
//            this->removeChild(sprinte_11_b, true);
//            this->removeChild(sprinte_11_y_a, true);
//            this->removeChild(sprinte_11_y_b, true);
                int new_value_11 = game_bj::e_11-10;
                if(new_value_11 <= 0)
                {
                    this->removeChild(sprinte_11, true);
                    this->removeChild(sprinte_11_a, true);
                    this->removeChild(sprinte_11_b, true);
                    this->removeChild(sprinte_11_y_a, true);
                    this->removeChild(sprinte_11_y_b, true);
                    CCProgressTimer *pt = (CCProgressTimer*)getChildByTag(71);
                    if(pt)
                    {
                        this->removeChild(pt, true);
                    }
                    game_bj::e_11 = 100;

                }
                CCProgressTimer *pt = (CCProgressTimer*)getChildByTag(71);
                if(pt)
                {
                    pt->setPercentage(game_bj::e_11);
                    pt->setPosition( ccp(point.x, point.y-20) );
                    pt->setType(kCCProgressTimerTypeBar);
                    CCFiniteTimeAction *action_1 = CCMoveTo::create((7*(point.y-1))/520,ccp(point.x,1));
                    pt->runAction(action_1);

                    CCProgressTo *to = CCProgressTo::actionWithDuration(0.1, new_value_11);
                    pt->runAction(to);
                    game_bj::e_11 = game_bj::e_11-10;
                } else
                {
                    CCSprite *sprinte_11 = (CCSprite*)getChildByTag(11);
                    if(sprinte_11)
                    {
                        CCProgressTimer *pt = CCProgressTimer::progressWithSprite(CCSprite::create("hatchling_exp_02.png"));
                        pt->setPercentage(game_bj::e_11);
                        pt->setPosition( ccp(point.x, point.y-20) );
                        pt->setType(kCCProgressTimerTypeBar);
                        pt->setScale(0.4);
                        pt->setMidpoint(ccp(0,0));
                        pt->setBarChangeRate(ccp(1,0));
                        this->addChild(pt,0,71);
                        CCFiniteTimeAction *action_1 = CCMoveTo::create((7*(point.y-1))/520,ccp(point.x,1));
                        pt->runAction(action_1);

                        CCProgressTo *to = CCProgressTo::actionWithDuration(0.1, new_value_11);
                        pt->runAction(to);
                        game_bj::e_11 = game_bj::e_11-10;
                    }

                }






                CCSprite *item_gb = new CCSprite();
                item_gb->initWithFile("item_coin.png");
                item_gb->setPosition( ccp(point.x, point.y) );
                item_gb->setScale(game_bj::scale);
                this->addChild(item_gb, 0,61);
                CCJumpTo* mJumpTo = CCJumpTo::actionWithDuration(2.0f, ccp(280, 1), 230.0f, 1);
                CCActionInterval*  seq_aa = (CCActionInterval*)(CCSequence::actions(mJumpTo, NULL));
                item_gb->runAction(seq_aa);
            }

            if(ret_2)
            {
                CCPoint point = sprinte_12->getPosition();
                CCLOG("2");
                this->removeChild(sprinte_12, true);
                this->removeChild(sprinte_12_a, true);
                this->removeChild(sprinte_12_b, true);
                this->removeChild(sprinte_12_y_a, true);
                this->removeChild(sprinte_12_y_b, true);
                CCSprite *item_gb = new CCSprite();
                item_gb->initWithFile("item_coin.png");
                item_gb->setPosition( ccp(point.x, point.y) );
                item_gb->setScale(game_bj::scale);
                this->addChild(item_gb, 0,62);
                CCJumpTo* mJumpTo = CCJumpTo::actionWithDuration(2.0f, ccp(280, 1), 230.0f, 1);
                CCActionInterval*  seq_aa = (CCActionInterval*)(CCSequence::actions(mJumpTo, NULL));
                item_gb->runAction(seq_aa);
            }

            if(ret_3)
            {
                CCPoint point = sprinte_13->getPosition();

                int new_value = game_bj::e_13-10;
                CCLOG("%i",new_value);
                if(new_value <= 0)
                {
                    this->removeChild(sprinte_13, true);
                    this->removeChild(sprinte_13_a, true);
                    this->removeChild(sprinte_13_b, true);
                    this->removeChild(sprinte_13_y_a, true);
                    this->removeChild(sprinte_13_y_b, true);
                    CCProgressTimer *pt = (CCProgressTimer*)getChildByTag(73);
                    if(pt)
                    {
                        this->removeChild(pt, true);
                    }
                    game_bj::e_13 = 100;

                }
                CCProgressTimer *pt = (CCProgressTimer*)getChildByTag(73);
                if(pt)
                {
                    pt->setPercentage(game_bj::e_13);
                    pt->setPosition( ccp(point.x, point.y-20) );
                    pt->setType(kCCProgressTimerTypeBar);
                    CCFiniteTimeAction *action_1 = CCMoveTo::create((7*(point.y-1))/520,ccp(point.x,1));
                    pt->runAction(action_1);

                    CCProgressTo *to = CCProgressTo::actionWithDuration(0.1, new_value);
                    pt->runAction(to);
                    game_bj::e_13 = game_bj::e_13-10;
                } else
                {
                    CCSprite *sprinte_13 = (CCSprite*)getChildByTag(13);
                    if(sprinte_13)
                    {
                        CCProgressTimer *pt = CCProgressTimer::progressWithSprite(CCSprite::create("hatchling_exp_02.png"));
                        pt->setPercentage(game_bj::e_13);
                        pt->setPosition( ccp(point.x, point.y-20) );
                        pt->setType(kCCProgressTimerTypeBar);
                        pt->setScale(0.4);
                        pt->setMidpoint(ccp(0,0));
                        pt->setBarChangeRate(ccp(1,0));
                        this->addChild(pt,0,73);
                        CCFiniteTimeAction *action_1 = CCMoveTo::create((7*(point.y-1))/520,ccp(point.x,1));
                        pt->runAction(action_1);

                        CCProgressTo *to = CCProgressTo::actionWithDuration(0.1, new_value);
                        pt->runAction(to);
                        game_bj::e_13 = game_bj::e_13-10;
                    }

                }







                CCSprite *item_gb = new CCSprite();
                item_gb->initWithFile("item_coin.png");
                item_gb->setPosition( ccp(point.x, point.y) );
                item_gb->setScale(game_bj::scale);
                this->addChild(item_gb, 0,63);
                CCJumpTo* mJumpTo = CCJumpTo::actionWithDuration(2.0f, ccp(280, 1), 230.0f, 1);
                CCActionInterval*  seq_aa = (CCActionInterval*)(CCSequence::actions(mJumpTo, NULL));
                item_gb->runAction(seq_aa);
            }

            if(ret_4)
            {
                CCPoint point = sprinte_14->getPosition();
//            CCLOG("4");
//            this->removeChild(sprinte_14, true);
//            this->removeChild(sprinte_14_a, true);
//            this->removeChild(sprinte_14_b, true);
//            this->removeChild(sprinte_14_y_a, true);
//            this->removeChild(sprinte_14_y_b, true);

                int new_value_14 = game_bj::e_14-10;
                if(new_value_14 <= 0)
                {
                    this->removeChild(sprinte_14, true);
                    this->removeChild(sprinte_14_a, true);
                    this->removeChild(sprinte_14_b, true);
                    this->removeChild(sprinte_14_y_a, true);
                    this->removeChild(sprinte_14_y_b, true);
                    CCProgressTimer *pt = (CCProgressTimer*)getChildByTag(74);
                    if(pt)
                    {
                        this->removeChild(pt, true);
                    }
                    game_bj::e_14 = 100;

                }
                CCProgressTimer *pt = (CCProgressTimer*)getChildByTag(74);
                if(pt)
                {
                    pt->setPercentage(game_bj::e_14);
                    pt->setPosition( ccp(point.x, point.y-20) );
                    pt->setType(kCCProgressTimerTypeBar);
                    CCFiniteTimeAction *action_1 = CCMoveTo::create((7*(point.y-1))/520,ccp(point.x,1));
                    pt->runAction(action_1);

                    CCProgressTo *to = CCProgressTo::actionWithDuration(0.1, new_value_14);
                    pt->runAction(to);
                    game_bj::e_14 = game_bj::e_14-10;
                } else
                {
                    CCSprite *sprinte_14 = (CCSprite*)getChildByTag(14);
                    if(sprinte_14)
                    {
                        CCProgressTimer *pt = CCProgressTimer::progressWithSprite(CCSprite::create("hatchling_exp_02.png"));
                        pt->setPercentage(game_bj::e_14);
                        pt->setPosition( ccp(point.x, point.y-20) );
                        pt->setType(kCCProgressTimerTypeBar);
                        pt->setScale(0.4);
                        pt->setMidpoint(ccp(0,0));
                        pt->setBarChangeRate(ccp(1,0));
                        this->addChild(pt,0,74);
                        CCFiniteTimeAction *action_1 = CCMoveTo::create((7*(point.y-1))/520,ccp(point.x,1));
                        pt->runAction(action_1);

                        CCProgressTo *to = CCProgressTo::actionWithDuration(0.1, new_value_14);
                        pt->runAction(to);
                        game_bj::e_14 = game_bj::e_14-10;
                    }

                }



                CCSprite *item_gb = new CCSprite();
                item_gb->initWithFile("item_coin.png");
                item_gb->setPosition( ccp(point.x, point.y) );
                item_gb->setScale(game_bj::scale);
                this->addChild(item_gb, 0,64);
                CCJumpTo* mJumpTo = CCJumpTo::actionWithDuration(2.0f, ccp(280, 1), 230.0f, 1);
                CCActionInterval*  seq_aa = (CCActionInterval*)(CCSequence::actions(mJumpTo, NULL));
                item_gb->runAction(seq_aa);
            }

            if(ret_5)
            {
                CCPoint point = sprinte_15->getPosition();
                CCLOG("5");
                this->removeChild(sprinte_15, true);
                this->removeChild(sprinte_15_a, true);
                this->removeChild(sprinte_15_b, true);
                this->removeChild(sprinte_15_y_a, true);
                this->removeChild(sprinte_15_y_b, true);
                CCSprite *item_gb = new CCSprite();
                item_gb->initWithFile("item_coin.png");
                item_gb->setPosition( ccp(130, 340) );
                item_gb->setScale(game_bj::scale);
                this->addChild(item_gb, 0,64);
                CCJumpTo* mJumpTo = CCJumpTo::actionWithDuration(2.0f, ccp(280, 1), 230.0f, 1);
                CCActionInterval*  seq_aa = (CCActionInterval*)(CCSequence::actions(mJumpTo, NULL));
                item_gb->runAction(seq_aa);
            }


            CCPoint a = sprinte_xxx->getPosition();
            if( a.y>=477)
            {
                this->removeChild(sprinte_xxx, true);
                if(ii==101)
                {
                    game_bj::a=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("a", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==102)
                {
                    game_bj::b=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("b", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==103)
                {
                    game_bj::c=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("c", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==104)
                {
                    game_bj::d=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("d", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==105)
                {
                    game_bj::e=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("e", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==106)
                {
                    game_bj::f=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("f", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==107)
                {
                    game_bj::g=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("g", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==108)
                {
                    game_bj::h=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("h", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==109)
                {
                    game_bj::i=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("i", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==110)
                {
                    game_bj::j=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("j", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==111)
                {
                    game_bj::k=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("k", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                } else if(ii==112)
                {
                    game_bj::l=1;
//                CCUserDefault::sharedUserDefault()->setIntegerForKey("l", 1);
//                CCUserDefault::sharedUserDefault()->flush();
                }
            }
        }
    }


    for (int i=11; i<=15; i++)
    {
        CCSprite *sprinte_yyy = (CCSprite*)getChildByTag(i);
        CCSprite *sprinte_yyy_a = (CCSprite*)getChildByTag(i+10);
        CCSprite *sprinte_yyy_b = (CCSprite*)getChildByTag(i+20);
        CCSprite *sprinte_yyy_y_a = (CCSprite*)getChildByTag(i+30);
        CCSprite *sprinte_yyy_y_b = (CCSprite*)getChildByTag(i+40);
        CCSprite *sprinte_item_gb = (CCSprite*)getChildByTag(i+50);
        CCSprite *sprinte_pt = (CCSprite*)getChildByTag(i+60);
        if(sprinte_yyy)
        {
            CCPoint a = sprinte_yyy->getPosition();
            if( a.y <= 10)
            {
                this->removeChild(sprinte_yyy, true);
            }
        }
        if(sprinte_yyy_a)
        {
            CCPoint a = sprinte_yyy_a->getPosition();
            if( a.y <= 10)
            {
                this->removeChild(sprinte_yyy_a, true);
            }
        }
        if(sprinte_yyy_b)
        {
            CCPoint a = sprinte_yyy_b->getPosition();
            if( a.y <= 10)
            {
                this->removeChild(sprinte_yyy_b, true);
            }
        }
        if(sprinte_yyy_y_a)
        {
            CCPoint a = sprinte_yyy_y_a->getPosition();
            if( a.y <= 10)
            {
                this->removeChild(sprinte_yyy_y_a, true);
            }
        }
        if(sprinte_yyy_y_b)
        {
            CCPoint a = sprinte_yyy_y_b->getPosition();
            if( a.y <= 10)
            {
                this->removeChild(sprinte_yyy_y_b, true);
            }
        }
        if(sprinte_item_gb)
        {
            CCPoint a = sprinte_item_gb->getPosition();
            if( a.y <= 10)
            {
                this->removeChild(sprinte_item_gb, true);
            }
        }
        if(sprinte_pt)
        {
            CCPoint a = sprinte_pt->getPosition();
            if( a.y <= 10)
            {
                this->removeChild(sprinte_pt, true);
                game_bj::e_11 = 100;
                game_bj::e_12 = 100;
                game_bj::e_13 = 100;
                game_bj::e_14 = 100;
                game_bj::e_15 = 100;
            }
        }
    }


}