Cocos2D 为 Sequence 类定义了静态方法 'actions',如下所示:
+(id) actions: (FiniteTimeAction *) action1, ... { /* omitted */ }
我如何构建一个在运行时执行的操作列表,也许是从磁盘文件等读取?
我读到可变长度参数列表可以翻译成 (char *) 并以这种方式传递......
NSMutableArray *actions = [[NSMutableArray alloc] init];
[actions addObject: [DelayTime actionWithDuration:1]];
[actions addObject: [ScaleBy actionWithDuration:2 scale:4];
char *argList = (char *)malloc(sizeof(FiniteTimeAction *) * [actions count]);
[actions getObjects:(id *)argList];
[self runActions: actions];
这是执行此操作的“最佳方式”还是“正确”方式?他们是更好的替代品,更快的替代品吗?