ArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("animation/paopao/paopao.ExportJson");
amatrue = Armature::create("paopao");
amatrue->getAnimation()->playByIndex(0);//播放里面第一个动画
amatrue->setScale(-1,1); //如果是armature翻转就得用这个来。相当于filpx()
添加帧事件
amatrue->getAnimation()->setFrameEventCallFunc(this,frameEvent_selector(CDropUnit::onFrameEvent));
void CDropUnit::onFrameEvent(Bone *bone, const string& evt, int originFrameIndex, int currentFrameIndex)
{
char str[32];
sprintf(str,"%s",evt);
if(strcmp(str,"111") == 0)
{
//播放减血动画并处理相应的动作
m_pGCell->getElementLayer()->playBossArm(m_pGCell->getElementLayer()->getCoor().m_nX,m_pGCell->getElementLayer()->getCoor().m_nY);
}
}
转载于:https://blog.51cto.com/zhuoshenger/1652421