-1
如果我例如在我的遊戲中有水果,並且想要將所有水果CCSprites添加到CCArray,我該怎麼做?如何在CCArray中添加多個CCSprites
說我有下面的代碼:
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個蘋果和香蕉。
任何幫助,將不勝感激!
我真的不明白你的意思了。你能多解釋一下嗎?我是編程新手。 –
更新了我的答案。 – Guru