I have a 4 animation function in my Vehicle Class
How do I run my accelerate action animation and then call another class function like so
//ANIMATION
void Vehicle::drive()//DRIVE
{
for (int i = 0; i < 2; i++)
{
auto frame = SpriteFrame::create("Ship/VehicleOne/drive.png", Rect(90 * i / TIscale, 0 / TIscale, 90 / TIscale, 30 / TIscale));
animationFrames.pushBack(frame);
}
auto animation = Animation::createWithSpriteFrames(animationFrames, 0.1f);
auto animate = Animate::create(animation);
sprite->runAction(RepeatForever::create(animate));
}
void Vehicle::accelerate()//ACCELERATE
{
for (int i = 0; i < 6; i++)
{
auto frame = SpriteFrame::create("Ship/VehicleOne/accelerate.png", Rect(90 * i / TIscale, 0 / TIscale, 90 / TIscale, 30 / TIscale));
animationFrames.pushBack(frame);
}
auto animation = Animation::createWithSpriteFrames(animationFrames, 0.1f);
auto animate = Animate::create(animation);
sprite->runAction(Repeat::create(animate, 1));
sprite->runAction(CCSequence::create(cocos2d::Repeat::create(animate, 1), drive(), NULL));
}
Paying attention to the last part
sprite->runAction(CCSequence::create(cocos2d::Repeat::create(animate, 1), drive(), NULL));
Thanks everyone