发布时间: 2012-06-20 20:37:21 作者: rapoo
用FOR,和数组显示多个精灵并设置位置-(id) init {if((self=[super init])) {CGSize winSize=[CCDirector sharedDirector].winSize;[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGB565];background=[CCSprite spriteWithFile:@"blue-shooting-stars.png"];background.anchorPoint=ccp(0,0);[self addChild:background];[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_Default];movableSprites=[[NSMutableArray alloc] init];NSArray*images=[NSArray arrayWithObjects:@"bird.png",@"cat.png",@"dog.png",@"turtle.png", nil];for(inti=0; i<images.count;++i) {NSString*image=[images objectAtIndex:i];CCSprite*sprite=[CCSprite spriteWithFile:image];floatoffsetFraction=((float)(i+1))/(images.count+1);sprite.position=ccp(winSize.width*offsetFraction, winSize.height/2);[self addChild:sprite];[movableSprites addObject:sprite];}}returnself;}
20款移动开发框架平台介绍
微信公众平台如何保证access_token长期
中国城市列表相仿手机通讯录显示方式
Socket连接与HTTP联接
平添wifi定位功能
偷空写了两个游戏
java集合类 - 实现 细节
hidden visible display 的差别
春节前最后一个:立地群飞
64位 与32 位 差异