iphone - 在特定时间启动CCAction

标签 iphone ios ipad cocos2d-iphone

我想在特定时间启动 InFinite CCAction。我尝试使用 CCSequence,但它仅支持有限时间动画。

有什么想法吗?

最诚挚的问候, 帕拉斯

最佳答案

将您想要重复的操作放入方法中。然后将其放入您的 init 方法中

[[CCScheduler sharedScheduler] scheduleSelector:@selector(myMethod) forTarget:self interval:10 paused:NO];

这将在 10 秒后调用 myMethod,但是一旦进入 myMethod,您就会想要取消它的安排。所以我的方法应该是这样的。

- (void) myMethod
{
    [[CCScheduler sharedScheduler] unscheduleSelector:@selector(myMethod) forTarget:self];
    CCMoveBy *move = [CCMoveBy actionWithDuration:3 position:ccp(75,0)];
    CCRepeatForever *repeat = [CCRepeatForever actionWithAction:move];
    [mySprite runAction:repeat];
}

关于iphone - 在特定时间启动CCAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7801339/

相关文章:

iphone - 检查对象是否为 UIKeyboard

ios - 苹果使用哪种字体/字体大小作为 iOS 中的占位符

iphone - 递归 CoreData 属性

ios - AVCaptureMetadataOutput setMetadataObjectTypes 发现不支持的类型

ios - 用 iPadOs 在 iPad 上区分 iPad 和 mac

iphone - 分析器中的表格 View 单元出现内存泄漏?

iphone - 以编程方式更改工具栏上 UILabel (UIBarButtonItem) 的文本

ios - 当 VoiceOver 处于事件状态时,关闭 UITextField 中的 UIKeyboardTypeNumberPad?

ios - 从文档目录中删除文件

ios - 适用于新款 iPhone 7 (plus) 的 Phonegap/cordova 启动画面