例如,如果我的游戏中有水果,并且想将所有水果 CCSprites 添加到 CCArray 中,我该怎么做?
说我有以下代码:
CCSprite *Apple = [CCSprite spriteWithFile:@"Apple2.png"];
CCSprite *Banana = [CCSprite spriteWithFile:@"Banana2.png"];
这是我的 CCArray:
CCArray *FruitsArray = [CCSprite spriteWithFile:@"Banana.png", @"Apple.png", nil];// Why is this not working?
self.FruitsArray = [CCArray arrayWithCapacity:10];
我希望 FruitsArray 的容量为 10,所以它应该容纳 10 个苹果和香蕉。
任何帮助,将不胜感激!