随笔分类 -  Iphone学习&开发

摘要:这一周接触到Cocos2D开发,在它的官网上看到Ray Wenderlic写的关于cocos2d开发的文章,感觉写的挺好,翻译了一下。原文链接地址大家可以在上面看到作者的更多内容初次翻译文章,望各位关照,想说的话在作者的文章里边也有表述,就直接开始吧游戏截图例子下载:Cocos2DSimpleGame.zip(776 K) 下载次数:2563Cocos2D是iPhone开发中一个非常有用的库,它可以让你在创建自己的iPhone游戏时节省很多的时间。它具有很多的功能,比如sprite(精灵)扶持,非常酷的图形效果,动画效果,物理库,音频引擎等等。我是一个Cocos2D开发的新手,尽管有很多有用的 阅读全文
posted @ 2011-05-15 09:48 jeekun 阅读(613) 评论(0) 推荐(0) 编辑
摘要:关于NSArray,NSMutableArray的使用与内存问题(仅个人在使用过程中体会)偶已几种方式建立说明如下:第一种:FirstArray = [[NSArray arrayWithObjects:@"a",@"b",@"c",nil] retain];NSLog(@"FirstArray%d",[FirstArray count]);NSLog(@"FirstArray%d",[FirstArray retainCount]);此方式返回的retainCount为2,程序难免会leak, 阅读全文
posted @ 2011-05-11 11:31 jeekun 阅读(751) 评论(0) 推荐(0) 编辑
摘要:/******************************************************************************************* NSArray *******************************************************************************************/ /*---------------------------创建数组------------------------------*/ //NSArray *array = [NSArray alloc] initW 阅读全文
posted @ 2011-05-11 11:15 jeekun 阅读(1326) 评论(0) 推荐(0) 编辑
摘要:1. 代码CGRect rect1 = [self positionRect:sheep];CGRect rect2 = [self positionRect:cow];if (!CGRectIsNull(CGRectIntersection(rect1, rect2))) { //handle collision [sheep stopAction:jump_4ever];}2.然后 schedule 一个 1/30 或者 1/60 的 函数在里面进行检测。 阅读全文
posted @ 2011-05-11 10:05 jeekun 阅读(1752) 评论(0) 推荐(0) 编辑
摘要:通常调用某个动作的方法:1// 创建动作2id actionTo = [CCMoveTo actionWithDuration: 2 position:ccp(s.width-40, s.height-40)];34// 使用动作。(说明:tamara 是一个 CCSprite。) 5[tamara runAction: actionTo];瞬时动作顾名思义。瞬时动作就是不需要时间,马上就完成的动作。瞬时动作的共同基类是 InstantAction。放置 – Place效果类似于 node.Position = ccp(x, y)。之所以作为一个动作来实现是为了可以与其他动作形成一个连续动作。 阅读全文
posted @ 2011-04-29 16:29 jeekun 阅读(2374) 评论(0) 推荐(0) 编辑
摘要:查看官方文档可知,cocos2d支持两种不同的处理触摸事件的方法分别为:standard touch delegate 和 Targeted touch delegate1、standard touch delegate1.1定义@protocol CCStandardTouchDelegate <NSObject>@optional- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent 阅读全文
posted @ 2011-04-29 16:24 jeekun 阅读(2894) 评论(0) 推荐(0) 编辑