开发者

How do you turn sprites into objects , for mutable arrays?

开发者 https://www.devze.com 2023-02-08 17:33 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消