Fork me on GitHub
上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 125 下一页

2012年4月6日

摘要: 参考http://www.raywenderlich.com/1271/how-to-use-animations-and-sprite-sheets-in-cocos2d用到zwoptex工具。plist输出的时候,选择cocos2d格式。流程简介:先用plist创建一个spriteFrameCache然后创建一个spriteBatchNode然后创建一个队列存放Cache的图片然后创建一个CCAnimation对象播放这个队列然后创建一个action来播放动画。overif( (self=[super init])) {[[CCSpriteFrameCache sharedSpriteFr 阅读全文
posted @ 2012-04-06 19:27 pengyingh 阅读(566) 评论(0) 推荐(0)
摘要: CCParticleSystem *sun;//// fire // CCParticleSystem* ff = [CCParticleFire node];// ff.position = ccp(80,90); // ff.totalParticles = 50;// ff.life = 2.0f;// ff.texture = [[CCTextureCache sharedTextureCache] addImage: @"fire.png"];// [self addChild:ff... 阅读全文
posted @ 2012-04-06 18:19 pengyingh 阅读(383) 评论(0) 推荐(0)
摘要: 一:operations(任务)cocoa提供了三种不同的operations1:Block operations(NSBlockOperation)Thesefacilitate the execution ofone or more block objects.C代码#import<UIKit/UIKit.h>@inter<span>f</span>aceOperationsAppDelegate:NSObject<UIApplicationDelegate>{UIWindow*window;NSBlockOperation*simpleOp 阅读全文
posted @ 2012-04-06 18:00 pengyingh 阅读(3973) 评论(0) 推荐(0)
摘要: http://o0o0o0o.iteye.com/blog/8055811:CCSpriteBatchNodeCCSpriteBatchNode* batch = [CCSpriteBatchNode batchNodeWithFile:@"bullet.png"]; CCArray* bullets = [batch children];2:用多个单独的文件创建动画CCAnimation, CCSpriteFrame+(CCAnimation*) animationWithFile:(NSString*)name frameCount:(int)frameCount de 阅读全文
posted @ 2012-04-06 17:59 pengyingh 阅读(2867) 评论(0) 推荐(0)
摘要: 转载地址:http://blog.csdn.net/ssihc0/article/details/6784819 CCSpriteFrameCache *cache = [CCSpriteFrameCache sharedSpriteFrameCache]; [cache addSpriteFramesWithFile:@"t1.plist" textureFile:@"t1.png"]; CCSprite *mySprite = [CCSprite spriteWithSpriteFrameName:@"a1.png"]; mySp 阅读全文
posted @ 2012-04-06 17:46 pengyingh 阅读(864) 评论(0) 推荐(0)
摘要: 一般游戏图片资源会打包成一张大图,这样节省空间,又提升速度。打包工具有Zwoptex和texturepacker等等。 CCSpriteBatchNode的初始化只要一张图片,也就是那张大图。然后把所有用到那张大图里面的小图的sprite都加到 CCSpriteBatchNode的child,绘制效率就会提高。1) 缓冲sprite帧和纹理 // 从纹理贴图集中预加载精灵帧,这个方法做了以下几件事:寻找工程目录下面和输入的参数名字一样,但是后缀是.png的图片文件。然后把这个文件加入到共享的CCTextureCache中。解析plist文件,追踪所有的sprite在spritesheet... 阅读全文
posted @ 2012-04-06 16:56 pengyingh 阅读(6093) 评论(0) 推荐(0)
摘要: http://blog.sina.com.cn/s/blog_8c7c56230100utax.htmlcocos2d中层颜色的改变,在0.9版本中使用如下的方法:在.h文件中如下声明接口HelloworldLayer : CCColorLayer{}在.m文件中的init中做如下修改if( (self=[super initWithColor:ccc4(255,255,255,255)] )){}但是在1.0以上版本中却将CCColorLayer改成CCLayerColor,其他的使用方法一样在.h文件中声明接口如下HelloworldLayer :CCLayerColor{}在.m文件中的 阅读全文
posted @ 2012-04-06 15:17 pengyingh 阅读(737) 评论(0) 推荐(0)
摘要: 在cocos2d 1.0一下,会有CCSpriteSheet提示,但是在1.0以上的版本中,CCSpriteSheet已经被替换成CCSpriteBatchNode,其相应的方法也被替换,如:CCSpriteSheet*mgr = [CCSpriteSheetspriteSheetWithFile:@"flight.png"capacity:5];已被替换成:CCSpriteBatchNode*mgr = [CCSpriteBatchNodebatchNodeWithFile:@"flight.png"capacity:5]; 阅读全文
posted @ 2012-04-06 14:49 pengyingh 阅读(811) 评论(0) 推荐(0)
摘要: Labels and Fonts 标签和字体Introduction 介绍cocos2d 支持 TTF (True Type Fonts) 标签和纹理 atlas 标签.Pros and Cons of TTF labels: (Label)+ All the pros of TTF fonts: any size, kerning support, etc.+ 简单实用,不需要外部编辑器.- 创建和更新很慢,因为一个新的纹理将要被创建Pros and Cons of texture atlas labels: (LabelAtlas,BitmapFontAtlas)+ 创建和更新很快,因为它 阅读全文
posted @ 2012-04-06 14:40 pengyingh 阅读(2809) 评论(0) 推荐(0)
摘要: Labels and Fonts 标签和字体Introduction 介绍cocos2d 支持 TTF (True Type Fonts) 标签和纹理 atlas 标签.Pros and Cons of TTF labels: (Label)+ All the pros of TTF fonts: any size, kerning support, etc.+ 简单实用,不需要外部编辑器.- 创建和更新很慢,因为一个新的纹理将要被创建Pros and Cons of texture atlas labels: (LabelAtlas,BitmapFontAtlas)+ 创建和更新很快,因为它 阅读全文
posted @ 2012-04-06 13:59 pengyingh 阅读(1183) 评论(0) 推荐(0)
上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 125 下一页

导航