• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ callfuncN_selector函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中callfuncN_selector函数的典型用法代码示例。如果您正苦于以下问题:C++ callfuncN_selector函数的具体用法?C++ callfuncN_selector怎么用?C++ callfuncN_selector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: centerSprites

//------------------------------------------------------------------
//
//	ActionCallFunc
//
//------------------------------------------------------------------
void ActionCallFunc::onEnter()
{
    ActionsDemo::onEnter();

    centerSprites(3);

    CCFiniteTimeAction*  action = CCSequence::actions(
                                      CCMoveBy::actionWithDuration(2, CGPointMake(200,0)),
                                      CCCallFunc::actionWithTarget(this, callfunc_selector(ActionCallFunc::callback1)),
                                      NULL);

    CCFiniteTimeAction*  action2 = CCSequence::actions(
                                       CCScaleBy::actionWithDuration(2 ,  2),
                                       CCFadeOut::actionWithDuration(2),
                                       CCCallFuncN::actionWithTarget(this, callfuncN_selector(ActionSequence2::callback2)),
                                       NULL);

    CCFiniteTimeAction*  action3 = CCSequence::actions(
                                       CCRotateBy::actionWithDuration(3 , 360),
                                       CCFadeOut::actionWithDuration(2),
                                       CCCallFuncND::actionWithTarget(this, callfuncND_selector(ActionSequence2::callback3), (void*)0xbebabeba),
                                       NULL);

    m_grossini->runAction(action);
    m_tamara->runAction(action2);
    m_kathia->runAction(action3);
}
开发者ID:shootan,项目名称:Terraria,代码行数:32,代码来源:ActionsTest.cpp


示例2: ccp

 void EnemyLayer::addEnemy1(float dt)
{
	//调用绑定敌机1  
	Enemy* enemy1 = Enemy::create();
	enemy1->bindSprite(CCSprite::create("enermy1.png"), 100);

	//随机初始位置  
	CCSize enemy1Size = enemy1->getSprite()->getContentSize();
	CCSize winSize = CCDirector::sharedDirector()->getWinSize();
	int minX = enemy1Size.width / 2;
	int maxX = winSize.width - enemy1Size.width / 2;
	int rangeX = maxX - minX;
	int actualX = (rand() % rangeX) + minX;

	enemy1->setPosition(ccp(actualX, winSize.height + enemy1Size.height / 2));
	this->addChild(enemy1);
	this->m_pAllEnemy1->addObject(enemy1);

	//随机飞行速度  
	float minDuration, maxDuration;

	//根据游戏难度给minDuration,maxDuration赋值  

	int rangeDuration = maxDuration - minDuration;
	int actualDuration = (rand() % rangeDuration) + minDuration;

	CCFiniteTimeAction* actionMove = CCMoveTo::create(actualDuration, ccp(actualX, 0 - enemy1->getSprite()->getContentSize().height / 2));
	CCFiniteTimeAction* actionDone = CCCallFuncN::create(this, callfuncN_selector(EnemyLayer::enemy1MoveFinished));//回调一个子弹结束处理函数 

	CCSequence* sequence = CCSequence::create(actionMove, actionDone);
	enemy1->runAction(sequence);
}
开发者ID:hmitjack,项目名称:CocosGames,代码行数:32,代码来源:EnemyLayer.cpp


示例3: CCRectMake

/**
* add some enemies into game
*/
void HelloWorld::addTarget ()
{
    //CCRectMake size picture(27x40)
    CCSprite* target = CCSprite::create("Target.png", CCRectMake(0, 0, 27, 40));
    //set tag
    target->setTag(1);
    mtargets->addObject(target);
    //get sizeWindown
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    //get size target
    int minY = target->getContentSize().height/2;
    int maxY = winSize.height-target->getContentSize().height/2;

    int rangeY = maxY - minY;
    //random position target
    int actualY = (rand() % rangeY) + minY;
    target->setPosition(ccp( winSize.width+(target->getContentSize().width/2), actualY));

    //add target into game
    this->addChild(target);

    //random speed from 2 to 4
    int speed = (rand() % 2) + 2;
    //create the action move from position to min x with speed = speed
    CCFiniteTimeAction* actionMove = CCMoveTo::create((float)speed,
                                     ccp(0-target->getContentSize().width/2, actualY));
    //action when target move finish: call function spriteMoveFinished
    CCFiniteTimeAction* actionMoveDone = CCCallFuncN::create(this,
                                         callfuncN_selector(HelloWorld::spriteMoveFinished));
    //action when
    target->runAction (CCSequence::create(actionMove, actionMoveDone, NULL));
}
开发者ID:nhanv,项目名称:tutorial1,代码行数:35,代码来源:HelloWorldScene.cpp


示例4: onUserStone

void CQuickProduct::onUserStone(CCObject* pSender)
{
	CButton *btn = (CButton*)pSender;
	CPopTip *tip = (CPopTip*)btn->getParent()->getParent();
	
	CCScaleTo *smal = CCScaleTo::create(0.2f,0.0f);
	CCSequence *seque = CCSequence::createWithTwoActions(smal, CCCallFuncN::create(this,callfuncN_selector(CQuickProduct::removeTip)));
	tip->runAction(seque);

	if (btn->getTag()==1)
	{
		/*tip->removeFromParent();*/
// 		CPopTip *pop = CPopTip::create("tips/bg.png");
// 		pop->addBeforeImage("tips/blackbg.png",0,20);
// 		pop->addButton("public/btn_yellow_befor.png","public/btn_yellow_after.png",nullptr,3,1);
// 		pop->buttonAddImage("public/font_queiding.png",3);
// 		pop->addTextRichTip("沒有足夠的鑽石",ccWHITE,"Arail",18.0f);
// 		/*pop->addRichImage("mainCity/icon_11.png");*/
// 		pop->reloadTextRich(ccp(VCENTER.x,VCENTER.y+50));
// 
// 		pop->setBottomOffset(-10);
// 		pop->setTouchEnabled(true);
// 		pop->setTouchPriority(-100);
// 		pop->setButtonLisener(this,ccw_click_selector(CQuickProduct::onUserStone));
// 		this->addChild(pop,10,2);
// 		pop->runScaleAction();
//		ShowPopTextTip(GETLANGSTR(263));
	}	
	LayerManager::instance()->pop();
	LayerManager::instance()->pop();
}
开发者ID:54993306,项目名称:Classes,代码行数:31,代码来源:QuickProduct.cpp


示例5: addChild

bool ArrowTest::init()
{
    if (!CCNode::init())
    {
        return false;
    }
    
    CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
    CCLayerColor* layer = CCLayerColor::create(ccc4(255, 255, 255, 255), screenSize.width, screenSize.height);
    addChild(layer);

    m_arrow = Arrow::create();
    addChild(m_arrow);
    
    CCPoint startPoint = ccp(500,600);
    CCPoint endPoint = ccp(500,500);
    float shootHeight = 100;
    
    CCJumpTo* jump = CCJumpTo::create(0.5f, endPoint, shootHeight, 1);
    m_arrow->spawnAtPosition(startPoint);
    CCCallFuncN* callback = CCCallFuncN::create(m_arrow, callfuncN_selector(Arrow::shootEnd));
    CCFiniteTimeAction* seq = CCSequence::create(jump, CCDelayTime::create(0.4f), callback, NULL);
    m_arrow->runAction(seq);

    return true;
}
开发者ID:ryanflees,项目名称:CocosAI,代码行数:26,代码来源:ArrowTest.cpp


示例6: rand

void EnemyLayer::addEnemy1(float dt){
    Enemy* enemy1 = Enemy::create();
    CCAnimation *animation;
    CCAnimate* animate;
    int enemyType = rand()%3;
    switch (enemyType) {
        case 0:
            enemy1->bindSprite(CCSprite::createWithSpriteFrame(enemy1SpriteFrame),Level1, ENEMY_MAX_LIFE1);
            break;
        case 1:
            enemy1->bindSprite(CCSprite::createWithSpriteFrame(enemy2SpriteFrame),Level2, ENEMY_MAX_LIFE2);
            break;
        case 2:
            enemy1->bindSprite(CCSprite::createWithSpriteFrame(enemy3SpriteFrame_1),Level3, ENEMY_MAX_LIFE3);
            animation = CCAnimation::create();
            animation->setDelayPerUnit(0.2f);
            animation->addSpriteFrame(enemy3SpriteFrame_1);
            animation->addSpriteFrame(enemy3SpriteFrame_2);
            animate = CCAnimate::create(animation);
            enemy1->getSprite()->runAction(CCRepeatForever::create(animate));
            break;
        default:
            enemy1->bindSprite(CCSprite::createWithSpriteFrame(enemy1SpriteFrame),Level1, ENEMY_MAX_LIFE1);
            break;
    }
    this->addChild(enemy1);
    m_pAllEnemy1->addObject(enemy1);
    CCSize enemy1Size = enemy1->getContentSize();
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    int minX = enemy1Size.width/2;
    int maxX =winSize.width -minX;
    int rangeX = maxX - minX;
    int aclX = (rand()%rangeX) + minX;
    enemy1->setPosition(ccp(aclX, winSize.height+enemy1Size.height));
    float minDuration,maxDuration;
    switch (GameLayer::getGameLevel()) {
        case EASY:
            minDuration = 3;
            maxDuration = 8;
            break;
        case NORMAL:
            minDuration = 1;
            maxDuration = 3;
            break;
        case HARD:
            minDuration = 0.5;
            maxDuration = 1;
            break;
            
        default:
            break;
    }
    int rangeDuration = maxDuration - minDuration;
    int aclDuration = (rand()%rangeDuration) + minDuration;
    CCFiniteTimeAction* moveTo = CCMoveTo::create(aclDuration, ccp(aclX, -2*enemy1Size.height));
    CCFiniteTimeAction* moveDone = CCCallFuncN::create(this, callfuncN_selector(EnemyLayer::enemyMoveFinish));
    CCSequence* sequence = CCSequence::create(moveTo,moveDone);
    enemy1->runAction(sequence);
    
}
开发者ID:hbflyhbfly,项目名称:AirPlane,代码行数:60,代码来源:EnemyLayer.cpp


示例7: callfuncN_selector

void Unit_Bishop::Real_TouchMove(const CCPoint& movePos)
{
    CCFiniteTimeAction* move = CCMoveTo::create(1.0f, movePos);
    CCFiniteTimeAction* callBack = CCCallFuncN::create(this, callfuncN_selector(Unit_Bishop::Delegate_FinishMove));
    CCAction* action = CCSequence::create(move, callBack, NULL);
    sprite->runAction(action);
}
开发者ID:bwjdrl2,项目名称:Infinity,代码行数:7,代码来源:Unit_Bishop.cpp


示例8: setNextBullet

void Towers::finishFiring() {
	if (!_target) {
		return;
	}
	DataModel *m = DataModel::getModel();

	setNextBullet(Bullet::create(BULLET_NAME[bulletTag].c_str(),bulletTag,Info::getInfo()->bulletInfo->value[bulletTag]));
	getNextBullet()->setPosition(getPosition());

	this->getParent()->addChild(getNextBullet(),1);
	m->getProjectiles()->addObject(getNextBullet());

	float delta = 1.0;
	CCPoint shootVector = ccpSub(_target->getPosition(),getPosition());
	CCPoint normalizedShootVector = ccpNormalize(shootVector);
	CCPoint overshotVector = ccpMult(normalizedShootVector, 320);
	CCPoint offscreenPoint = ccpAdd(getPosition(), overshotVector);

	getNextBullet()->runAction(CCSequence::create(CCMoveTo::create(delta,offscreenPoint),
		CCCallFuncN::create(this,callfuncN_selector( Towers::creepMoveFinished)),NULL));

	getNextBullet()->setTag(bulletTag);

	setNextBullet(NULL);

}
开发者ID:pototao,项目名称:DefenseTest,代码行数:26,代码来源:Towers.cpp


示例9: endPos

bool TextFieldTTFActionTest::onTextFieldDeleteBackward(CCTextFieldTTF * pSender, const char * delText, int nLen)
{
    // create a delete text sprite and do some action
    CCLabelTTF * label = CCLabelTTF::create(delText, FONT_NAME, FONT_SIZE);
    this->addChild(label);

    // move the sprite to fly out
    CCPoint beginPos = pSender->getPosition();
    CCSize textfieldSize = pSender->getContentSize();
    CCSize labelSize = label->getContentSize();
    beginPos.x += (textfieldSize.width - labelSize.width) / 2.0f;
    
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    CCPoint endPos(- winSize.width / 4.0f, winSize.height * (0.5 + (float)rand() / (2.0f * RAND_MAX)));

    float duration = 1;
    float rotateDuration = 0.2f;
    int repeatTime = 5; 
    label->setPosition(beginPos);

    CCAction * seq = CCSequence::create(
        CCSpawn::create(
            CCMoveTo::create(duration, endPos),
            CCRepeat::create(
                CCRotateBy::create(rotateDuration, (rand()%2) ? 360 : -360),
                repeatTime),
            CCFadeOut::create(duration),
        0),
        CCCallFuncN::create(this, callfuncN_selector(TextFieldTTFActionTest::callbackRemoveNodeWhenDidAction)),
        0);
    label->runAction(seq);
    return false;
}
开发者ID:GhostSoar,项目名称:Cocos2dWindows,代码行数:33,代码来源:TextInputTest.cpp


示例10: callfuncN_selector

void ChatWidget::initInputBar()
{
    float bw = 100;
    float bh = 70;
    if(1){
        //send button
        m_sendButton = new BasButton;
        m_sendButton->setButtonInfo("",m_theme
                                    ,m_sendImg,CCSizeMake(bw,bh),m_sendPressedImg);
        this->addChild(m_sendButton);
        m_sendButton->setRight("parent",uilib::Right);
        m_sendButton->setBottom("parent",uilib::Bottom);
        m_sendButton->setMargins(2);
        m_sendButton->setClickCB(this,callfuncND_selector(ChatWidget::onSendButtonClicked));
    }
    if(1){
        //facing button
        m_facingButton = new BasButton;
        m_facingButton->setButtonInfo("",m_theme,"chatface",CCSizeMake(bh,bh));
        this->addChild(m_facingButton);
        m_facingButton->setMargins(2);
        m_facingButton->setBottom("parent",uilib::Bottom);
        m_facingButton->setRight(m_sendButton->getName(),uilib::Left);
        m_facingButton->setClickCB(this,callfuncND_selector(ChatWidget::onFacingClicked));
    }
    if(1){
        //phrase button
        m_phraseButton = new BasButton;
        m_phraseButton->setButtonInfo("",m_theme,"chatuparrow",CCSizeMake(bh,bh));
        this->addChild(m_phraseButton);
        m_phraseButton->setMargins(2);
        m_phraseButton->setBottom("parent",uilib::Bottom);
        m_phraseButton->setRight(m_facingButton->getName(),uilib::Left);
        m_phraseButton->setClickCB(this,callfuncND_selector(ChatWidget::onPhraseClicked));
    }
    if(1){
        //chat to button
        m_toButton = new BasButton;
        m_toButton->setButtonInfo("",m_theme,"chatto",CCSizeMake(bh,bh));
        this->addChild(m_toButton);
        m_toButton->setMargins(2);
        m_toButton->setBottom("parent",uilib::Bottom);
        m_toButton->setLeft("parent",uilib::Left);
        m_toButton->setClickCB(this,callfuncND_selector(ChatWidget::onChatToClicked));
    }
    if(1){
        //init input
        m_inputBox = new InputBox;
        m_inputBox->setTheme(m_theme,"inputbg");
        m_inputBox->setMaxLength(50);
        this->addChild(m_inputBox);
        m_inputBox->setMargins(2);
        m_inputBox->setMaxHeightRefSize(m_sendButton->getName(),1.0);
        m_inputBox->setMinHeightRefSize(m_sendButton->getName(),1.0);
        m_inputBox->setLeft(m_toButton->getName(),uilib::Right);
        m_inputBox->setBottom("parent",uilib::Bottom);
        m_inputBox->setRight(m_phraseButton->getName(),uilib::Left);
        m_inputBox->setOnReturned(this, callfuncN_selector(ChatWidget::onInputBoxReturned));
    }
}
开发者ID:firedragonpzy,项目名称:DirectFire-android,代码行数:60,代码来源:chatwidget.cpp


示例11: setLotteryContext

void PopupLayer::setLotteryContext(Size size)
{
	//Size winSize = Director::getInstance()->getWinSize();
	Size center =(winSize - size)/2;
    //10*3的单元格
    for(int row=0; row<10; row++)
    {
        for(int col=0; col<3; col++)
        {			
			LotteryCard* card = LotteryCard::createCardSprite((row+1)+ col*10, 40,40, center.width+20+row*(size.width/11), (winSize.height/2+30)-40*col);
			card->setTag((row+1)+ col*10);	
			card->setBallCallbackFunc(this,callfuncN_selector(PopupLayer::refreshBallBackGround));

			addChild(card);
			lotteryVector.pushBack(card);
			
			for(int i=0;i<selected_number_vector.size();i++)
			{
				if(selected_number_vector.at(i) == (row+1)+ col*10)
				{				
					card->setVisible(false);
				}
			}						
        }
    }
}
开发者ID:coolshou,项目名称:richer,代码行数:26,代码来源:PopupLayer.cpp


示例12: callfuncN_selector

void MainScene::PushFlyingBubbles(const MatchesList_t& bubbles)
{
	size_t size = bubbles.size();
	for (size_t i = 0; i < size; ++i)
	{
		CCPointArray *array = CCPointArray::create(20);

		int x = m_BubbleViewDisplacement.x + bubbles[i].y * (BubbleElement::GetBubbleSize() + m_SpaceBetweenBubbles);
		int y = VisibleRect::top().y - m_BubbleViewDisplacement.y - BubbleElement::GetBubbleSize() - bubbles[i].x * (BubbleElement::GetBubbleSize() + m_SpaceBetweenBubbles);

		array->addControlPoint(ccp(x, y));
		array->addControlPoint(ccp(x + 30, y + 30));
		array->addControlPoint(ccp(x + 60, y + 50));
		array->addControlPoint(ccp(x + 80, y + 70));
		array->addControlPoint(ccp(750, 400));

		CCCardinalSplineTo *action = CCCardinalSplineTo::create(1.5, array, 0);
		CCFiniteTimeAction* actionMoveDone = CCCallFuncN::create( this, callfuncN_selector(MainScene::RemoveFlyingBubbles));
		CCFiniteTimeAction *seq = CCSequence::create(action, actionMoveDone, NULL);

		BubbleElement* bubble = new BubbleElement(static_cast<BubbleElement*>(m_BubblesView[bubbles[i].y][bubbles[i].x])->GetType());
	
		bubble->setPosition(CCPointMake(x, y));
		bubble->runAction(seq);
		addChild(bubble);
	}
}
开发者ID:LoveMengSi,项目名称:HungryChameleon-Andriod,代码行数:27,代码来源:MainScene.cpp


示例13: CCAssert

void CCBlackHoleManager::runBlackHoleEffect(ccGridSize gridSize, 
                                         ccTime duration, 
                                         CCPoint bkPoint, 
                                         CCNode *pTarget,
                                         const char *pszFileBlackHole)
{
    if (this->m_isRunning)
    {
        return;
    }
    
    CCAssert(pTarget != NULL, "Invalid Target!");
    
    CCNode *parent = (CCSprite *)pTarget->getParent();
    CCAssert(parent != NULL, "Invalid parent!");
    
    if (strcmp(pszFileBlackHole, "") != 0)
    {
        this->runBlackHoleSprite(parent, duration, bkPoint, pszFileBlackHole);
    }
    
    this->m_isRunning = true;
    pTarget->runAction(CCSequence::actions(CCSuckInAction::actionWithSize(gridSize, duration, bkPoint),
                                           CCCallFuncN::actionWithTarget(this, callfuncN_selector(CCBlackHoleManager::removeSprite)),
                                           NULL));
}
开发者ID:supersuraccoon,项目名称:Cocos2dxEffectComboDemo,代码行数:26,代码来源:CCBlackHoleManager.cpp


示例14: moveBackgroundSprite

//移动背景图片
void SnowNight::moveBackgroundSprite(CCNode *sender)
{
    
    int zorder = 0;
    
    if (sender != NULL) {
        zorder = sender->getZOrder();
        sender->runAction(CCSequence::create(CCFadeOut::create(4),CCRemoveSelf::create(),NULL));
    }
    
    //创建背景精灵
    CCSprite *bgSprite = CCSprite::createWithTexture(bgTexture);
    float bgSpritespx = bgTexture->getContentSize().width;
    float bgSpritespy = bgTexture->getContentSize().height;
    //设置精灵位置
    bgSprite->setPosition(ccp(0,winSize.height/2));
    bgSprite->setScaleX(winSize.width/bgSpritespx*2);//宽度放大2倍
    bgSprite->setScaleY(winSize.height/bgSpritespy);
    
    this->addChild(bgSprite, zorder-1);
    
    CCFiniteTimeAction* actionMove = CCMoveTo::create( (float)winSize.width/BACKGROUND_MOVE_SPEED,ccp(winSize.width, winSize.height/2) );
    CCFiniteTimeAction* actionMoveDone = CCCallFuncN::create( this,callfuncN_selector(SnowNight::moveBackgroundSprite));
    bgSprite->runAction( CCSequence::create(actionMove,actionMoveDone, NULL) );
    
}
开发者ID:joveth,项目名称:WeatherEffectsDemo,代码行数:27,代码来源:SnowNight.cpp


示例15: tRect

KDbool CScrGame::ccTouchBegan ( CCTouch* pTouch, CCEvent* pEvent )
{
    KDbool  bRet = KD_FALSE;
    
    for ( KDuint  i = 0; i < 2; i++ )
    {
		CCRect  tRect ( CCPointZero, m_uiPad[i][0]->getContentSize ( ) );
        if ( tRect.containsPoint ( m_uiPad[i][0]->convertTouchToNodeSpace ( pTouch ) ) )
        {
            bRet = KD_TRUE;
            
            m_uiPad[i][1]->setUserData  ( pTouch );
            m_uiPad[i][1]->setVisible ( KD_FALSE );
            m_uiPad[i][2]->setVisible ( KD_TRUE );
            
            if ( m_pWeapon->getAction ( i ) != CWeapon::eActHold || m_uBulletNum [ m_uWeaponIndex ][ i ] == 0 )
            {
                continue;
            }
            
            CCFiniteTimeAction*  pAction = ( CCSequence::create
			(
                CCRepeat::create
                (
                    CCSequence::create
                    (
                        CCCallFuncN::create ( this, callfuncN_selector ( CScrGame::onFire ) ), 
                        CCDelayTime::create ( m_pWeapon->getFireDelay ( ) / 1000.f ),
                        KD_NULL
                    ),
                    KD_MIN ( m_pWeapon->getFireRepeat ( ), m_uBulletNum [ m_uWeaponIndex ][ i ] )  
                ),
                CCCallFuncN::create ( this, callfuncN_selector ( CScrGame::onFired ) ),
                KD_NULL
            ) ); 
    
            m_uiPad[i][1]->runAction ( pAction ); 
        }
    }
    
    if ( !bRet && m_tWorldTouch.getID ( ) == 0 )
    {
        m_tWorldTouch = *pTouch;
    }
    
    return KD_TRUE;
}
开发者ID:mcodegeeks,项目名称:OpenKODE-Framework,代码行数:47,代码来源:ScrGame.cpp


示例16: rand

void HelloWorld::addTarget()
{
    CCSprite *target = CCSprite::create("Target.png");
    CCSize size = target->getContentSize();
    
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();

 
    //위에서 아래로 떨어진다
    int minX = target->getContentSize().width;
    int maxX = target->getContentSize().width*40;
 
    int rangeX = maxX - minX;
    int actualX = ( rand() % rangeX ) + minX;
 
    target->setPosition(ccp(actualX,winSize.height));
    this->addChild(target);
 
 
    int minDuration = (int)2.0;
    int maxDuration = (int)4.0;
    int rangeDuration = maxDuration - minDuration;
    int actualDuration = ( rand() % rangeDuration ) + minDuration;
 
    CCFiniteTimeAction* actionMove = CCMoveTo::create((float)actualDuration, ccp(actualX,-1));
 
    CCFiniteTimeAction* actionMoveDone = CCCallFuncN::create(this,callfuncN_selector(HelloWorld::spriteMoveFinished));
 
    target->runAction(CCSequence::create(actionMove, actionMoveDone, NULL));
 
 
    /*
     //오른쪽에서 왼쪽으로 지나간다
    int minY = target->getContentSize().height/2;
    int maxY = winSize.height - target->getContentSize().height/2;
    
    int rangeY = maxY - minY;
    int actualY = ( rand() % rangeY ) + minY;
    
    target->setPosition(ccp(winSize.width + (target->getContentSize().width/2),actualY));
    
    this->addChild(target);
    
    
    int minDuration = (int)2.0;
    int maxDuration = (int)4.0;
    int rangeDuration = maxDuration - minDuration;
    int actualDuration = ( rand() % rangeDuration ) + minDuration;
    
    CCFiniteTimeAction* actionMove = CCMoveTo::create((float)actualDuration, ccp(0-target->getContentSize().width/2,actualY));

    CCFiniteTimeAction* actionMoveDone = CCCallFuncN::create(this,callfuncN_selector(HelloWorld::spriteMoveFinished));
    
    target->runAction(CCSequence::create(actionMove, actionMoveDone, NULL));
    */
    target->setTag(1);
    _targets->addObject(target);
    
}
开发者ID:ChungH,项目名称:OOP-study,代码行数:59,代码来源:HelloWorldScene.cpp


示例17: SetTouchable

void CardMgr::RunBeginAction() {
  //这个要设置为false,否则会宕机,原因未知。。。
  SetTouchable(false);
  play_scene_->ShowStartTips(true);
  CCOrbitCamera * orbit1 = CCOrbitCamera::create(0.25, 0.5, 0, 0, 90, 0, 0);
  CCCallFuncN* change_card1 = CCCallFuncN::create(this, callfuncN_selector(CardMgr::ChangeCardToSpriteBack));
  CCOrbitCamera * orbit2 = CCOrbitCamera::create(0.25, 0, -0.5, 90, 90, 0, 0);
  CCMoveBy* move1 = CCMoveBy::create(0.25, ccp(0,50));
  CCMoveBy* move2 = CCMoveBy::create(0.25, ccp(0,-50));
  CCOrbitCamera * orbit3 = CCOrbitCamera::create(0.25, 0.5, 0, 0, 90, 0, 0);
  CCCallFuncN* change_card2 = CCCallFuncN::create(this, callfuncN_selector(CardMgr::ChangeCardToSpriteFront));
  CCOrbitCamera * orbit4 = CCOrbitCamera::create(0.25, 0, -0.5, 90, 90, 0, 0);
  CCCallFuncN* end = CCCallFuncN::create(this, callfuncN_selector(CardMgr::BeginActionEnd));
  CCSequence* tmp = CCSequence::create(orbit1,change_card1,orbit2,move1,move2,orbit3,change_card2,orbit4,end,NULL);
  CCSprite* src = (CCSprite*)card_layer_->getChildByTag(bingo_index_);
  src->runAction(tmp);
}
开发者ID:f17qh,项目名称:crazyass,代码行数:17,代码来源:card_manager.cpp


示例18: callfuncN_selector

void RatingSprite::runAnimation(){
	this->stopAllActions();
	CCActionInterval* cd= CCScaleTo::create(2,1,1);
	CCActionInterval* cd2=CCScaleTo::create(2,1,0);
	CCCallFuncN *onComplete = CCCallFuncN::create(this, callfuncN_selector(RatingSprite::runAnimationCallBack));
	CCSequence* ce=CCSequence::create(cd,cd2,onComplete,NULL);
	this->runAction(ce);
}
开发者ID:joyfish,项目名称:cocos2d-1,代码行数:8,代码来源:RatingSprite.cpp


示例19: setVisiable

void FairyControlPanel::setVisiable(){
	if(!isDoClick){
		CCActionInterval * moveBy = CCMoveBy::create(0.3f,ccp(0,
			-panelBack->getContentSize().height - 30));
		panelBack->runAction(CCSequence::create(moveBy->reverse(), 
			CCCallFuncN::create(this,callfuncN_selector(FairyControlPanel::finishDoClick)),NULL));
	}
}
开发者ID:fairysmile,项目名称:cocos2d-x,代码行数:8,代码来源:FairyControlPanel.cpp


示例20: z_move

void Zombie::z_move(){
    float speed = this->z_speed;
    
    CCFiniteTimeAction* actionMoveDone = CCCallFuncN::create(this->z_sprite_sheet,callfuncN_selector(Zombie::spriteMoveFinished));
    
    float x = this->z_sprite_sheet->getPositionX();
    float y = this->z_sprite_sheet->getPositionY();
    
    if(this->z_alive()){
        if((x == 128.0) && (y < 240.0)){
            y = y + speed;
            this->z_sprite_sheet->setPosition(x,y);
            this->z_sprite_sheet->setVisible(true);
        }
        else if((x < 384.0) && (y >= 240.0)){
            x = x + speed;
            this->z_sprite_sheet->setPosition(x,y);
            this->z_sprite_sheet->setVisible(true);
        }
        else if((x >= 384.0) && (y > 100.0)){
            y = y - speed;
            this->z_sprite_sheet->setPosition(x,y);
            this->z_sprite_sheet->setVisible(true);
        }
        else if((x > 258.0) && (y <= 100.0)){
            x = x - speed;
            this->z_sprite_sheet->setPosition(x,y);
            this->z_sprite_sheet->setVisible(true);
        }
        else if((x <= 258.0) && (y < 128.0)){
            y = y + speed;
            this->z_sprite_sheet->setPosition(x,y);
            this->z_sprite_sheet->setVisible(true);
        }
        else if((x == 258.0) && (y == 128.0))
            this->z_sprite_sheet->runAction(actionMoveDone);
        
        
        
        
        if((x == 128.0) && (y == 240.0)){
            //printf(" zOrder = %d",this->z_sprite_sheet->getZOrder());
            this->z_speed = 0.5;
            setSpriteBatch(5);
        }
        else if((x == 384.0) && (y ==240.0)){
            this->z_sprite_sheet->setZOrder(60 - this->z_sprite_sheet->getZOrder());
            setSpriteBatch(9);
        }
        else if((x == 384.0) && (y == 100.0)){
            setSpriteBatch(13);
        }
        else if((x == 258.0) && (y == 100.0)){
            this->z_sprite_sheet->setZOrder(60 - this->z_sprite_sheet->getZOrder());
            setSpriteBatch(1);
        }
    }
}
开发者ID:chenwenbiao,项目名称:zombie-tower-defense-ios,代码行数:58,代码来源:Zombie.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ callfuncO_selector函数代码示例发布时间:2022-05-30
下一篇:
C++ callfuncND_selector函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap