【幻灯片分享】在iOS平台上用Cocos2D做开发 | iOS独立开发者 秦春林 | iOS DevCamp

游戏引擎移植者现身讲解:《在iOS平台上用Cocos2D做开发》 | iOS独立开发者 秦春林 | iOS DevCamp

议题简介:Cocos2d是iOS平台上著名的游戏引擎,它开源,结构简单清晰,功能强大,是个人或者中小型团队开发的首选方案。本议题将以引擎移植者的身份清晰的讲解Cocos2D的结构,除此之外,还会分享App开发中的实际问题,例如灵活使用层,管理好触摸,整合使用Box2d物理引擎,Cocos2D与UIKit的整合等等开发中遇到的常见问题。

讲师简介:秦春林:独立开发者,曾就职于K2,金和,从事企业方面的开发,之后加入北京友录,OpenXLive从事Windows phone产品开发。2011年参与Cocos2d-x到Windows phone平台的移植,贡献了大部分核心功能,对Coco2D游戏引擎有深刻的了解,现从事iOS开发。热爱开源,喜欢交流。


【幻灯片在线观看】*:

<iframe src="http://www.slideshare.net/slideshow/embed_code/13838588" width="597" height="486" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen=""> </iframe>

备注:* 因为炫姐姐对SlideShare这一平台的偏爱,尽管需要使点小技巧才能上传分享,但是炫姐姐还是坚持选择了这一功能强大却简洁好用的平台。一来对国外这些开发出优秀的工具和平台、造福于互联网和人类的团队表示致敬,二来则是对国内对于这些优秀的工具和平台的限制表示一下立场。读者如果不能正常浏览,那么需要像炫姐姐一样用点小技巧。而对于那些还是不知道炫姐姐在说什么的小白读者,可以移步到这里查询原因。


【幻灯片下载页面】:iOS DevCamp幻灯片分享:在iOS平台上用Cocos2D做开发 | iOS独立开发者 秦春林 -来自CSDN下载频道(不需要积分,自由下载)


【幻灯片内容刚要】:

1. iOS DevCamp Produced by CSDN
2. 怎样灵活使用Cocos2D 秦春林
3. Don’t reinvent the wheel
4. “In the summer of 2008, several "pythoneros" went to a camp program called PyCamp: Python outdoors. This camp held in Cordoba, in the town of Los Cocos. We were about 50 people. It covered different topics, one of which was seeking way of not having to "reinvent the wheel" in each jurisdiction Pyweek. In this way a group of friends and I decided to put together a framework to make games. We call cocos2d, since the framework is designed to make 2D games, and the word "coconut" emulates the place where the camp took place.” Ricardo Quesada
5. 4,000+ games
6. It is free! Without having to learn OpenGL ES to get started Active community & tests Lots of tools It is Simple Why Cocos2d?
7. How simple?
8. sprite: player Action: CCMoveTo layer: GameLayer scene: GameScene UIView:EAGLView
9. Game has Scenes Each Scene has some number of Layers Layers capture user interaction and contain sprites Director manages the scenes Cocos2d Basics
10. Anything thats gets drawn or contains things that get drawn is a CCNode
11. CCLayer CCMenu CCMenuItemLabel CCMenuItem CCMenuItemSprite CCMenuItemToggle CCParticleSystem CCNode CCScene CCTransitionScene CCSprite CCLabelTTF CCLabelBMFont CCSpriteBatchNode CCTMXLayer
12. Just like UIView
13. They can contain other CCNode nodes (addChild, getChildByTag, removeChild, etc) They can schedule periodic callback (schedule, unschedule, etc) They can execute actions (runAction, stopAction, etc) main features
14. Features of CCNode: - position - scale (x, y) - rotation (in degrees, clockwise) - CCCamera (an interface to gluLookAt ) - CCGridBase (to do mesh transformations) - anchor point - size - visible - z-order - openGL z position
15. - (CGAffineTransform)nodeToParentTransform; - (CGAffineTransform)parentToNodeTransform; - (CGAffineTransform)nodeToWorldTransform; - (CGAffineTransform)worldToNodeTransform; - (CGPoint)convertToNodeSpace:(CGPoint)worldPoint; - (CGPoint)convertToWorldSpace:(CGPoint)nodePoint; - (CGPoint)convertTouchToNodeSpace:(UITouch *)touch; transformation
16. CCLayer GamePlay CCScene CCLayer GamePlayScene Background
17. CCLayer is a subclass of CCNode that implements: - UIAccelerometerDelegate - CCStandardTouchDelegate - CCTargetedTouchDelegate
19. (NSSet*)touches NO targetedHandlersCount>o standardHandlersCount>o YES foreach...in touches YES foreach...in mutablesTouches foreach...in handlers ccTouchesBegan/Move/ End NO ccTouchBegan YES ccTouchMove/End NO End swallowsTouches NO YES remove from mutableTouches
21. You must register as a targeted touch delegate ccTouchBegan be invoked separately for each of the available touches The ccTouchBegan method return YES to indicate a touch you care about The swallowsTouches property return YES to indicate only this layer handle the touch Targeted Touch Delegate
22. A sample: How dose CCMenu work?
24. Which item is clicked?
26. Priority = 2 GameLayer Priority = 1 Priority = 0 Which Layer handle touch events?=
27. Return YES to claim the touch. -(BOOL)ccTouchBegan ! //* priority used by the menu for the event handler ! kCCMenuHandlerPriority = -128,
29. CCSprite is a 2d image
36. How does CCAction work?
39. Simple,but powerful
42. Box2D is C++ 2D rigid physics simulation engine with continuous collision detection All you files thats touch C++ or include it must be Objective- C++(.mm) Tuned for 1 meter sized objects Box2D v2.2.0 User Manual COCOS2D+BOX2D
43. A game in 6 steps
44. setp 1
45. what have the template done for us? initPhysics createMenu draw addNewSpriteAtPosition update ccTouchesEnded
47. Create the dynamic blocks setp 2
50. Touch events setp 3
52. Penguin animation setp 4
54. Fun with Particle Systems setp 5
55. music & effect [[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"Penguino.mp3"]; [[SimpleAudioEngine sharedEngine] playEffect:@"PenguinSqueak3.mp3"]; setp 6
56. Labels and Fonts Particle system Tiled maps Draw & update Effects & Grid & Camera Transitions DrawingPrimitives RenderTexture Shader (2.0) ...... more features
58. THANK YOU ElvisQin@me.com weibo.com/hielvis Now, how about this game?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值