Thank you very much!!more question.my role attack animate have 1.5 second duration,and I want do collision detection at the some point in the middle of the duration. but I don't know how get it.

look this chart,for example I want at the position 19 do collision detection, So I should use duration(1.5) x position(19) / all(29) to get it? I use this way get it indeed,but I want know how the other people get it?
and more question,I debug find the play an animation(3rd param set false) and it don't stop unless I call the "AnimationState_clearAnimation" the animate time keep growing.
I should do many logical processing in the game about animate (e.g. after playing attack animation play idle animation). I do all these processing according to the animate time at the update function?
void HelloWorld::update (float deltaTime)
{
if (_hero->state->animation&&strcmp(_hero->state->animation->name,"attack")==0&&_hero->state->time >= 0.632)
{
cocos2d::CCRect rc=_hero->boundingBox();
if (rc.intersectsRect(_robot->boundingBox()))
{
//CCLog("%f,%f,%f,%f",rc.origin.x,rc.origin.y,rc.size.width,rc.size.height);
CCLog("ATTACK
---
");
}
}
if(AnimationState_isComplete(_hero->state)==true)
{
AnimationState_setAnimationByName(_hero->state, "idle", true);
}
}