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


C++ CCNode::getActionByTag方法代码示例

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


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

示例1: activate

// When activated, scale the parent CCNode by the value of the activatedScale property.
// The current scale value of the parent is cached again, in case that scale had been
// changed since this adornment was added to the parent. We do not simply use a deactivation
// scale of 1 / activationScale in case the activation scaling is interrupted by the
// deactivation, and has not fully scaled up at the time the deactivation starts.
// The action is tagged so that it can be easily found if it needs to be cancelled.
void CCNodeAdornmentScaler::activate()
{
	CCNode* p = getParent();
	if ( p == NULL )
		return;

	CCAction* currAction = p->getActionByTag( kScaleActionTag );
	if ( currAction ) 
	{
		// if we already have an active action, cancel it
		p->stopAction( currAction );
	} 
	else
	{
		// only cache scale if a scaling action is not active
		// because otherwise scale will be evolvin and we'll cache something halfway
		setOriginalScaleFromParent();
	}
	// use scaleTo instead of scaleBy so that final size is deterministic in the case
	// where we have interrupted an active scaling action above
	float finalScaleX = _originalScale.width * _activatedScale.width;
	float finalScaleY = _originalScale.height * _activatedScale.height;
	CCAction* scaleAction = CCActionScaleTo::create( getActionDuration(), finalScaleX, finalScaleY );
	scaleAction->setTag( kScaleActionTag );
	p->runAction( scaleAction );
}
开发者ID:ClAndHHL,项目名称:cocos3d-x,代码行数:32,代码来源:CCNodeAdornments.cpp

示例2: showMoveAction

void CSmeltArmor::showMoveAction( const char* name )
{
	CCNode* pNode = ((CCNode*)m_ui->findWidgetById(name));
	if(pNode->getActionByTag(999) == nullptr)
	{
		CCRepeatForever* pAction = CCRepeatForever::create(CCSequence::createWithTwoActions(CCMoveBy::create(0.7f, ccp(0, 15)), CCMoveBy::create(0.7f, ccp(0, -15))));
		pAction->setTag(999);
		pNode->runAction(pAction);
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:10,代码来源:SmeltArmor.cpp

示例3: ccTouchBegan

bool MainLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{ /*-- 跳动作 --*/
	//CCDirector::sharedDirector()->replaceScene(FinishLayer::scene());
	CCSize vsize = CCDirector::sharedDirector()->getVisibleSize();
	CCPoint location = pTouch->getLocation();
	CCNode *node = 0;
	if (location.x < vsize.width / 2)
	{
		if (!leftJumping)
		{
			node = this->getChildByTag(TAG_LEFT);
			leftJumping = true;
		}
	}
	else
	{
		if (!rightJumping)
		{
			node = this->getChildByTag(TAG_RIGHT);
			rightJumping = true;
		}
	}
	if (node)
	{
		CCActionInterval *jump = CCJumpBy::create(speed / ratio, ccp(0, 0),
				node->getContentSize().height, 1);
		node->runAction(jump);
		CCActionInterval *moving = (CCActionInterval*) node->getActionByTag(
		TAG_ACTION_MOVE);
		if (moving)
		{
			node->runAction(CCSpeed::create(moving, 1.2f));
		}
		playJumpAnimation(node);
	}
	return true;
}
开发者ID:beforeeight,项目名称:bump,代码行数:37,代码来源:MainLayer.cpp


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