gpt4 book ai didi

ios - 如何在cocos2d中启动CCBFile动画随叫随到?

转载 作者:行者123 更新时间:2023-11-29 02:54:26 25 4
gpt4 key购买 nike

我在 Sprite Builder 中创建了 CCBFile 并添加到主场景中,现在当我运行项目时,CCBFile 动画会自动启动。我想在延迟一段时间后启动或调用它...有什么想法吗?

这是我的代码...

@implementation MainScene {
CCPhysicsNode *_physicsNode;
CCNode *playerbackwardshort;

}

// is called when CCB file has completed loading
- (void)didLoadFromCCB {

//For Delay
[self performSelector:@selector(Upgrade) withObject:nil afterDelay:0.6];
}


-(void)Upgrade{
CCBAnimationManager* am = self.userObject;
[am runAnimationsForSequenceNamed:@"playerbackwardshort"];
}

最佳答案

CCBAnimationManager 用于此目的。假设您将动画命名为“AnimationTest”。要阻止它自动运行,时间线属性中有一个选项 ( see here )

// in the loaded ccb file's class
CCBAnimationManager* animationManager = self.userObject;
[animationManager runAnimationsForSequenceNamed:@"AnimationTest"];

关于ios - 如何在cocos2d中启动CCBFile动画随叫随到?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24096922/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com