本文整理汇总了C++中CCArmature::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CCArmature::getParent方法的具体用法?C++ CCArmature::getParent怎么用?C++ CCArmature::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCArmature
的用法示例。
在下文中一共展示了CCArmature::getParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
}
}
示例2: comCallBack
void SceneRender::comCallBack(cocos2d::CCObject *tar, void *dict)
{
if (dict == NULL || tar == NULL)
{
return;
}
CCArmature *pAr = dynamic_cast<CCArmature*>(tar);
if (pAr == NULL)
{
return;
}
rapidjson::Value *v = (rapidjson::Value *)dict;
bool isShowColliderRect = DICTOOL->getBooleanValue_json(*v, "isShowColliderRect");
if (isShowColliderRect == false)
{
return;
}
ColliderRectDrawer *drawer = ColliderRectDrawer::create(pAr);
if (pAr->getParent())
{
pAr->getParent()->addChild(drawer);
}
drawer->setVisible(true);
}