How do you turn sprites into objects , for mutable arrays?
I have a mutable array which stores sprites but the problem is that the sprites aren't objects and need to be created into objects so that they can be stored in the array, i am using cocos2d. Here is my code 开发者_Python百科so far.
NSMutableArray *sprites = [[NSMutableArray alloc] init]; int spritecount = 0;
[sprites insertObject:red1 atIndex:spritecount++];
[sprites insertObject:red2 atIndex:spritecount++];
If you are talking about CCSprites
, they DO inherit from NSObject
, so you should be able to insert them in a NSMutableArray
.
精彩评论