当前位置: 首页>>代码示例>>C++>>正文


C++ Star::removeFromParentAndCleanup方法代码示例

本文整理汇总了C++中Star::removeFromParentAndCleanup方法的典型用法代码示例。如果您正苦于以下问题:C++ Star::removeFromParentAndCleanup方法的具体用法?C++ Star::removeFromParentAndCleanup怎么用?C++ Star::removeFromParentAndCleanup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Star的用法示例。


在下文中一共展示了Star::removeFromParentAndCleanup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: deleteSelectedList

void StarMatrix::deleteSelectedList()
{
	if(selectedList.size() <= 1)
	{
		m_layer->hideLinkNum();
		selectedList.at(0)->setSelected(false);
		return;
	}

	for(auto it = selectedList.begin();it != selectedList.end();it++)
	{
		Star* star = *it;

		showStarParticleEffect(star->getColor(),star->getPosition(),this);
		stars[star->getIndexI()][star->getIndexJ()] = nullptr;
		star->removeFromParentAndCleanup(true);

		Audio::getInstance()->playPop();
	}

	showComboEffect(selectedList.size(),this);
	Audio::getInstance()->playCombo(selectedList.size());

	refreshScore();
	m_layer->showLinkNum(selectedList.size());
	adjustMatrix();

	if(isEnded())
	{
		m_layer->floatLeftStarMsg(getLeftStarNum());
		CCLOG("ENDED");
	}

}
开发者ID:JiangWeiGitHub,项目名称:Cocos2d-X,代码行数:34,代码来源:StarMatrix.cpp

示例2: deleteSelectedList

void StarMatrix::deleteSelectedList(){
	//播放消除音效
	Audio::getInstance()->playPop();

	for(auto it = selectedList.begin();it != selectedList.end();it++){
		Star* star = *it;
		m_layer->showEveryScore(selectedListSize,5+(selectedListSize-selectedList.size())*5,selectedListSize-selectedList.size(),star->getPosition(),touchLeft);
		selectedList.pop_front();
		//粒子效果
		showStarParticleEffect(star->getColor(),star->getPosition(),this);
		stars[star->getIndexI()][star->getIndexJ()] = nullptr;
		star->removeFromParentAndCleanup(true);
		return;
	}
	clearOneByOne =false;
	//COMBO效果
	showComboEffect(selectedListSize,this);
	m_layer->showLinkNum(selectedListSize);
	selectedListSize=0;
	acceptTouch =true;
	adjustMatrix();
	if(isEnded()){
		acceptTouch=false;
		m_layer->hideProps();
		m_layer->floatLeftStarMsg(getLeftStarNum());//通知layer弹出剩余星星的信息
		CCLOG("ENDED");
	}
}
开发者ID:joyfish,项目名称:cocos2d,代码行数:28,代码来源:StarMatrix.cpp

示例3: addStars

void GameLayer::addStars(void) {
    
    Star * star;
    //number of stars and boosts to add to this level
    _numStars = _manager->getTotalStars();
    int numBoosts = _manager->getBoostNumber();
    

    int cnt = 0;
    int i = 0;

    int index;
    CCPoint starPosition;
    CCPoint position;
    
    
    while (cnt < _numStars) {
        
        starPosition = _manager->starPosition(i);
        i++;
        
        //grab stars array index based on selected Grid Cell
        index = starPosition.y * _manager->getColumns() + starPosition.x;
        
        if (index >= STARS_IN_POOL) {
            continue;
        }
    
        //grab position from selected Grid Cell
        position.x = starPosition.x * TILE;
        position.y = _screenSize.height - starPosition.y * TILE;
        
        //don't use cells too close to moon perch
        
        if (fabs(position.x  - _moonStartPoint.x) < _moon->getRadius() * 2 &&
            fabs(position.y - _moonStartPoint.y) < _moon->getRadius() * 2) {
            continue;
        }
         
        
        //grab star from pool
        star = (Star *) _manager->starFromPool(index);
        if (star->getParent()) star->removeFromParentAndCleanup(false);
        if (star->getOpacity() != 255) star->setOpacity(255);
        
        //add boosts first, if any
        if ( cnt >= _numStars - numBoosts) {
            star->setValues(position, true);
            
        } else {
            star->setValues(position, false);
        }
        
        _gameBatchNode->addChild(star, kMiddleground);
        star->setVisible(true);
        
        cnt++;
    }
}
开发者ID:Ratel13,项目名称:moon-herder-cocos2d-x,代码行数:59,代码来源:GameLayer.cpp

示例4: deleteBombList

void StarMatrix::deleteBombList(){
	//播放消除音效
	Audio::getInstance()->playPropBomb();
	for(auto it = selectedList.begin();it != selectedList.end();it++){
		Star* star = *it;
		//粒子效果
		showStarParticleEffect(star->getColor(),star->getPosition(),this);
		stars[star->getIndexI()][star->getIndexJ()] = nullptr;
		star->removeFromParentAndCleanup(true);
	}
	selectedList.clear();
	//COMBO效果
	selectedListSize=0;
	acceptTouch =true;
	adjustMatrix();
	if(isEnded()){
		acceptTouch=false;
		m_layer->hideProps();
		m_layer->floatLeftStarMsg(getLeftStarNum());
	}
}
开发者ID:joyfish,项目名称:cocos2d,代码行数:21,代码来源:StarMatrix.cpp

示例5: createHelpScreen


//.........这里部分代码省略.........
    this->addChild(_boostHitParticles);
    this->addChild(_lineHitParticles);
    this->addChild(_groundHitParticles);
    this->addChild(_starHitParticles);
    
    _drawLayer = DrawLayer::create();
    this->addChild(_drawLayer, kForeground);
    
    _sun->setPosition(ccp(_screenSize.width * 0.5f, -_sun->getRadius()));
    _sun->setNextPosition(ccp(_screenSize.width * 0.5f, -_sun->getRadius()));
    
    _sun->setVisible(false);
    _sun->reset();
    
     
    //reset moon and perch
    _moon->setPosition(_moonStartPoint);
    _moon->setNextPosition(_moonStartPoint);
    _moon->reset();
    _moonPerch->setOpacity(50);
    
    
    _starsCollected = false;
    
    _drawLayer->setStartPoint(ccp(0,0));
    _drawLayer->setTouchPoint(ccp(0,0));
    
    _bgDark->setOpacity (255);
    _bgLight->setOpacity(0);
    
    _starsUpdateIndex = 0;
    _starsUpdateRange = 10;
    _starsUpdateInterval = 5;
    _starsUpdateTimer = 0.0;
    
    //add stars
    Star * star;
    //number of stars and boosts to add to this level
    _numStars = 5;
    int numBoosts = 1;
    
    
    int cnt = 0;
    int i = 0;
    
    int index;
    CCPoint starPosition;
    CCPoint position;
    
    
    while (cnt < _numStars) {
        
        starPosition = _manager->starPosition(i);
        i++;
        
        //grab stars array index based on selected Grid Cell
        index = starPosition.y * _manager->getColumns() + starPosition.x;
        
        if (index >= STARS_IN_POOL) {
            continue;
        }
        
        //grab position from selected Grid Cell
        position.x = starPosition.x * TILE;
        position.y = _screenSize.height - starPosition.y * TILE;
        
        //don't use cells too close to moon perch
        
        if (fabs(position.x  - _moonStartPoint.x) < _moon->getRadius() * 2 &&
            fabs(position.y - _moonStartPoint.y) < _moon->getRadius() * 2) {
            continue;
        }
        
        
        //grab star from pool
        star = (Star *) _manager->starFromPool(index);
        if (star->getParent()) star->removeFromParentAndCleanup(false);
        if (star->getOpacity() != 255) star->setOpacity(255);
        
        //add boosts first, if any
        if ( cnt >= _numStars - numBoosts) {
            star->setValues(position, true);
            
        } else {
            star->setValues(position, false);
        }
        
        _gameBatchNode->addChild(star, kMiddleground);
        star->setVisible(true);
        
        cnt++;
    }

    _tutorialLabel = CCLabelTTF::create("Draw lines to stop the moon\n from falling to the ground.\n\n\n Tap screen to begin.", "TrebuchetMS-Bold", 16, CCSize(_screenSize.width * 0.8f, _screenSize.height * 0.4f), kCCTextAlignmentCenter);
    _tutorialLabel->setPosition(ccp (_screenSize.width * 0.5f, _screenSize.height * 0.2f) );
    this->addChild(_tutorialLabel, kForeground);
    _labelTimer= 0;
    
    _gameState = kGameStatePlay;
}
开发者ID:Ratel13,项目名称:moon-herder-cocos2d-x,代码行数:101,代码来源:HelpLayer.cpp


注:本文中的Star::removeFromParentAndCleanup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。