本文整理汇总了C++中Armature::getParent方法的典型用法代码示例。如果您正苦于以下问题:C++ Armature::getParent方法的具体用法?C++ Armature::getParent怎么用?C++ Armature::getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Armature
的用法示例。
在下文中一共展示了Armature::getParent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void HelloWorld::update(float delta)
{
if(m_bStart)
{
ComRender *pHeroRender = (ComRender*)(m_pGameScene->getChildByTag(10005)->getComponent("CCArmature"));
Armature *pHero = (Armature*)(pHeroRender->getNode());
pHero->getParent()->setPositionX(pHero->getParent()->getPositionX() + m_fSpeed);
ComRender *pEnemyRender = (ComRender*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature"));
Armature *pEnemy = (Armature*)(pEnemyRender->getNode());
/* for 3.0 */
float distance = Point(pHero->getParent()->getPositionX(), 0).getDistance(Point(pEnemy->getParent()->getPositionX(), 0));
if (distance < m_fAttackDis)
{
pHero->getAnimation()->play("attack");
pHero->getAnimation()->setMovementEventCallFunc(this,
movementEvent_selector(HelloWorld::animationEvent));
m_bStart = false;
}
// before
/*
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)
{
ComRender *pUIRender = static_cast<ComRender*>(m_pGameScene->getChildByTag(10007)->getComponent("GUIComponent"));
/* for 3.0 */
Node* pUILayer = static_cast<Node*>(pUIRender->getNode());
Layout* root = static_cast<Layout*>(pUILayer->getChildren().at(2));
LoadingBar *pHPLoadingBar = static_cast<LoadingBar*>(Helper::seekWidgetByName(root, "hp02_LoadingBar"));
LoadingBar *pMPLoadingBar = static_cast<LoadingBar*>(Helper::seekWidgetByName(root, "mp02_LoadingBar"));
// before
/*
cocos2d::ui::TouchGroup *pUILayer = static_cast<cocos2d::ui::TouchGroup*>(pUIRender->getNode());
cocos2d::ui::LoadingBar *pHPLoadingBar = static_cast<cocos2d::ui::LoadingBar*>(pUILayer->getWidgetByName("hp02_LoadingBar"));
cocos2d::ui::LoadingBar *pMPLoadingBar = static_cast<cocos2d::ui::LoadingBar*>(pUILayer->getWidgetByName("mp02_LoadingBar"));
*/
/**/
pHPLoadingBar->setPercent(m_fPercentage);
pMPLoadingBar->setPercent(m_fPercentage);
m_fPercentage -= 2.0f;
if (m_fPercentage < 0.0f) {
unscheduleUpdate();
}
}
}