本文整理汇总了C++中CCComRender::getNode方法的典型用法代码示例。如果您正苦于以下问题:C++ CCComRender::getNode方法的具体用法?C++ CCComRender::getNode怎么用?C++ CCComRender::getNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCComRender
的用法示例。
在下文中一共展示了CCComRender::getNode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defaultPlay
void ArmatureComponentTest::defaultPlay()
{
CCComRender *pBlowFish = static_cast<CCComRender*>(m_rootNode->getChildByTag(10007)->getComponent("CCArmature"));
pBlowFish->getNode()->runAction(CCMoveBy::create(10.0f, ccp(-1000.0f, 0)));
CCComRender *pButterflyfish = static_cast<CCComRender*>(m_rootNode->getChildByTag(10008)->getComponent("CCArmature"));
pButterflyfish->getNode()->runAction(CCMoveBy::create(10.0f, ccp(-1000.0f, 0)));
}
示例2: update
/// 这里实现的是动画移动过程;
/// 重点:CCArmature *pButterFlyFish= (CCArmature *)(pFishRender->getNode());
void HelloWorld::update( float delta )
{
/// 获取节点信息 只有节点信息才是我们设置的信息
CCNode* pFishNode = m_pLoginScene->getChildByTag(10009);
CCPoint p1 = pFishNode->getPosition();
//获取comrender组件
CCComRender *pFishRender = (CCComRender*)(m_pLoginScene->getChildByTag(10009)->getComponent("CCArmature"));
//转换为armature 这里的armature是我们在动画中制作的相关数据了,因此下面我们要获得信息将会是我们在动画制作的数据
/// 而不是在场景制作中的数据;
CCArmature *pButterFlyFish= (CCArmature *)(pFishRender->getNode());
/// 这里获得动画中的坐标
CCPoint pt = pButterFlyFish->getPosition();
if (!m_bDirection)
{
p1.x -= 2.0f;
if (10 > p1.x)
{
m_bDirection = true;
}
}
else
{
p1.x += 2.0f;
if (900 < p1.x)
{
m_bDirection = false;
}
}
pFishNode->setPosition(p1);
}
示例3: update
void HelloWorld::update(float delta)
{
if(m_bStart)
{
CCArmature *pHero = (CCArmature*)(m_pGameScene->getChildByTag(10005)->getComponent("CCArmature")->getNode());
pHero->getParent()->setPositionX(pHero->getParent()->getPositionX() + m_fSpeed);
CCArmature *pEnemy = (CCArmature*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature")->getNode());
if(ccpDistance(ccp(pHero->getParent()->getPositionX(), 0), ccp(pEnemy->getParent()->getPositionX(), 0)) < m_fAttackDis)
{
pHero->getAnimation()->play("attack");
pHero->getAnimation()->setMovementEventCallFunc(this,
movementEvent_selector(HelloWorld::animationEvent));
m_bStart = false;
}
}
if(m_bDead)
{
CCComRender *pUIRender = static_cast<CCComRender*>(m_pGameScene->getChildByTag(10007)->getComponent("GUIComponent"));
UILayer *pUILayer = static_cast<UILayer*>(pUIRender->getNode());
UILoadingBar *pHPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("hp02_LoadingBar"));
UILoadingBar *pMPLoadingBar = static_cast<UILoadingBar*>(pUILayer->getWidgetByName("mp02_LoadingBar"));
pHPLoadingBar->setPercent(m_fPercentage);
pMPLoadingBar->setPercent(m_fPercentage);
m_fPercentage -= 2.0f;
if (m_fPercentage < 0.0f) {
unscheduleUpdate();
}
}
}
示例4: touchEvent
void UIComponentTest::touchEvent(CCObject *pSender, TouchEventType type)
{
switch (type)
{
case TOUCH_EVENT_BEGAN:
{
CCComRender *pBlowFish = static_cast<CCComRender*>(m_rootNode->getChildByTag(10010)->getComponent("CCArmature"));
pBlowFish->getNode()->runAction(CCMoveBy::create(10.0f, ccp(-1000.0f, 0)));
CCComRender *pButterflyfish = static_cast<CCComRender*>(m_rootNode->getChildByTag(10011)->getComponent("CCArmature"));
pButterflyfish->getNode()->runAction(CCMoveBy::create(10.0f, ccp(-1000.0f, 0)));
}
break;
default:
break;
}
}
示例5: getFish
CCArmature* SceneEditorTestLayer::getFish(int nTag, const char *pszName)
{
if (m_pCurNode == NULL)
{
return NULL;
}
CCComRender *pFishRender = (CCComRender*)(m_pCurNode->getChildByTag(nTag)->getComponent(pszName));
return (CCArmature *)(pFishRender->getNode());
}
示例6: removeAll
void ArmatureActionState::removeAll()
{
do
{
CCNode *pNode = SceneReader::sharedSceneReader()->getNodeByTag(_nTag);
CC_BREAK_IF(pNode == NULL);
CCComRender *pRender = (CCComRender*)(pNode->getComponent(_ComName.c_str()));
CC_BREAK_IF(pRender == NULL);
CCArmature *pAr = (CCArmature *)(pRender->getNode());
CC_BREAK_IF(pAr == NULL);
TriggerMng::sharedTriggerMng()->removeArmatureMovementCallBack(pAr, this, movementEvent_selector(ArmatureActionState::animationEvent));
} while (0);
}
示例7: done
void ArmaturePlayAction::done()
{
do
{
CCNode *pNode = SceneReader::sharedSceneReader()->getNodeByTag(_nTag);
CC_BREAK_IF(pNode == NULL);
CCComRender *pRender = (CCComRender*)(pNode->getComponent(_comName.c_str()));
CC_BREAK_IF(pRender == NULL);
CCArmature *pAr = (CCArmature *)(pRender->getNode());
CC_BREAK_IF(pAr == NULL);
pAr->getAnimation()->play(_aniname.c_str());
} while (0);
}
示例8: animationEvent
void HelloWorld::animationEvent(CCArmature *pArmature,
MovementEventType movementType, const char *movementID)
{
CCComRender *render = (CCComRender*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature"));
CCArmature *pEnemy = (CCArmature*)(render->getNode());
if (movementType == COMPLETE)
{
pEnemy->getAnimation()->play("death");
pArmature->getAnimation()->setMovementEventCallFunc(NULL, NULL);
m_bDead = true;
}
}
示例9: init
bool ArmatureActionState::init()
{
do
{
CCNode *pNode = SceneReader::sharedSceneReader()->getNodeByTag(_nTag);
CC_BREAK_IF(pNode == NULL);
CCComRender *pRender = (CCComRender*)(pNode->getComponent(_comName.c_str()));
CC_BREAK_IF(pRender == NULL);
CCArmature *pAr = (CCArmature *)(pRender->getNode());
CC_BREAK_IF(pAr == NULL);
TriggerMng::getInstance()->addArmatureMovementCallBack(pAr, this, movementEvent_selector(ArmatureActionState::animationEvent));
} while (0);
return true;
}
示例10: init
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
//////////////////////////////
// 1. super init first
if ( !CCLayer::init() )
{
return false;
}
m_fTime = 0.0f;
m_bStart = false;
m_bDead = false;
m_fPercentage = 100.0f;
m_fSpeed = 4.0f;
m_fAttackDis = 120.0f;
m_pGameScene = NULL;
CCNode *pGameScene = SceneReader::sharedSceneReader()->createNodeWithSceneFile("FightScene.json");
m_pGameScene = pGameScene;
this->addChild(pGameScene);
CCComRender *render = (CCComRender*)(m_pGameScene->getChildByTag(10005)->getComponent("CCArmature"));
CCArmature *pArmature = (CCArmature*)(render->getNode());
pArmature->getAnimation()->play("run");
m_bStart = true;
CCMenuItemFont *itemBack = CCMenuItemFont::create("End", this, menu_selector(HelloWorld::menuCloseCallback));
itemBack->setColor(ccc3(255, 255, 255));
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
menuBack->setPosition(CCPointZero);
menuBack->setZOrder(4);
this->addChild(menuBack);
scheduleUpdate();
return true;
}