Objective-C/Cocos2D - Display different Sprites with Animation on the same positon on the Screen -
hello have big question , don't find way solve problem till now.
i work on simple game objective-c , cocos2d.
i have 3 different objects (sprites animation) , 4 fixed position on screen.
alternately interval want display different objects on positions.
i wanted double for() position objects. , in for want create multidimensional array objects.
and want create method have access time-interval , frequency of different objects.
do think can solve problem solution or know better way…??
it great if me.
thanky you
[[ccspriteframecache sharedspriteframecache] addspriteframeswithfile:@"myplist.plist"]; myarray = [[ccarray alloc] init]; (int = 1; <= 2; i++) { (int j = 1; j <= 2; j++) { figure *figure = [figure spritewithspriteframename:@"a0001.png"]; figure.position = ccp(j * figure.contentsize.width + 50, * figure.contentsize.height + 50); [myarray addobject: figure]; [self addchild:figure z:1]; } }
i not know how structured plist, imagine have renamed images in way:
a0001.png a0002.png a0003.png
why don't try make more simple loop instead of "for inside for" place 3 images @ view , manage file this:
for (int = 1; < 3; i++) { figure *figure = [figure spritewithspriteframename:[nsstring stringwithformat:@"a000%i.png", i]] figure.position = //add fit layout [myarray addobject: figure]; [self addchild:figure z:1]; }
Comments
Post a Comment