请教,对比cocos2d 与 core animation

白马斩辰 2011-02-17 09:57:22
如题,现在cocos2d支持mac应用开发,那么cocos2d 与core animation哪个比较好用?
...全文
210 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
程序员小迷 2012-01-14
  • 打赏
  • 举报
回复
两个都要用,看在什么场合
h98458 2011-05-05
  • 打赏
  • 举报
回复
cocos2d吧,功能强大啊
ArthurChen 2011-05-05
  • 打赏
  • 举报
回复
这是两码事,不能比较
池边客 2011-05-03
  • 打赏
  • 举报
回复
cocos2d是针对游戏吧,它好象封装了opengle,用起来应该会方便一点。
o0松鼠0o 2011-03-09
  • 打赏
  • 举报
回复
2楼说的不错,core animation的强大在于对GUI进行了general style management,更方便出精品。
Janear 2011-02-18
  • 打赏
  • 举报
回复
前者的功能更强大点,core animation可以做出各种动画效果,cocos2d偏向于2D游戏的开发!

我也是刚学,只是初步认识。。如有错误,请指正。。Tks a lot!
Editorial Reviews Product Description The iPhone and iPod touch have provided all software developers with a level playing field—developers working alone have the same access to consumers as multinational software publishers. Very cool indeed! To make your application stand out from the crowd, though, it has to have that something extra. You must learn the skills to take your apps from being App Store filler to download chart-topping blockbusters. Developers with years of experience helped write this book. Spend some time understanding their code and why they took the approach they did. You will find the writing, illustrations, code, and sample applications second to none. No matter what type of application you are writing, you will find something in this book to help you make your app that little bit cooler. The book opens with Wolfgang Ante, the developer behind the Frenzic puzzle game, showing how timers, animation, and intelligence are used to make game play engaging. It moves on to Rogue Amoeba's Mike Ash explaining how to design a network protocol using UDP, and demonstrating its use in a peer-to-peer application—a topic not normally for the faint of heart, but explained here in a way that makes sense to mere mortals. Gary Bennett then covers the important task of multithreading. Multithreading can be used to keep the user interface responsive while working on other tasks in the background. Gary demonstrates how to do this and highlights traps to avoid along the way. Next up, Canis Lupus (aka Matthew Rosenfeld) describes the development of the Keynote-controlling application Stage Hand, how the user interface has evolved, and the lessons he has learned from that experience. Benjamin Jackson then introduces two open source libraries: cocos2d, for 2D gaming; and Chipmunk, for rigid body physics (think “collisions”). He describes the development of Arcade Hockey, an air hockey game, and explains some of the code used for this. Neil Mix of Pandora Radio reveals the science behind processing streaming audio. How do you debug what you can't see? Neil guides you through the toughest challenges, sharing his experience of what works and what to watch out for when working with audio. Finally, Steven Peterson demonstrates a comprehensive integration of iPhone technologies. He weaves Core Location, networking, XML, XPath, and SQLite into a solid and very useful application. Software development can be hard work. Introductory books lay the foundation, but it can be challenging to understand where to go next. This book shows some of the pieces that can be brought together to make complete, cool applications. Who is this book for? All iPhone application developers with any level of experience or coming from any development platform Summary of Contents Wolfgang Ante - Designing a Simple, Frenzic-Style Puzzle Game Mike Ash - Mike Ash’s Deep Dive Into Peer-to-Peer Networking Gary Bennett - Doing Several Things at Once: Performance Enhancements with Threading Matthew “Canis” Rosenfeld - All Fingers and Thumbs: Multitouch Interface Design and Implementation Benjamin Jackson - Physics, Sprites, and Animation with the cocos2d-iPhone Framework Neil Mix - Serious Streaming Audio the Pandora Radio Way Steven Peterson - Going the Routesy Way with Core Location, XML, and SQLite
The iPhone and iPod touch have provided all software developers with a level playing field—developers working alone have the same access to consumers as multinational software publishers. Very cool indeed! To make your application stand out from the crowd, though, it has to have that something extra. You must learn the skills to take your apps from being App Store filler to download chart-topping blockbusters. Developers with years of experience helped write this book. Spend some time understanding their code and why they took the approach they did. You will find the writing, illustrations, code, and sample applications second to none. No matter what type of application you are writing, you will find something in this book to help you make your app that little bit cooler. The book opens with Wolfgang Ante, the developer behind the Frenzic puzzle game, showing how timers, animation, and intelligence are used to make game play engaging. It moves on to Rogue Amoeba's Mike Ash explaining how to design a network protocol using UDP, and demonstrating its use in a peer-to-peer application—a topic not normally for the faint of heart, but explained here in a way that makes sense to mere mortals. Gary Bennett then covers the important task of multithreading. Multithreading can be used to keep the user interface responsive while working on other tasks in the background. Gary demonstrates how to do this and highlights traps to avoid along the way. Next up, Canis Lupus (aka Matthew Rosenfeld) describes the development of the Keynote-controlling application Stage Hand, how the user interface has evolved, and the lessons he has learned from that experience. Benjamin Jackson then introduces two open source libraries: cocos2d, for 2D gaming; and Chipmunk, for rigid body physics (think “collisions”). He describes the development of Arcade Hockey, an air hockey game, and explains some of the code used for this. Neil Mix of Pandora Radio reveals the science behind processing streaming audio. How do you debug what you can't see? Neil guides you through the toughest challenges, sharing his experience of what works and what to watch out for when working with audio. Finally, Steven Peterson demonstrates a comprehensive integration of iPhone technologies. He weaves Core Location, networking, XML, XPath, and SQLite into a solid and very useful application. Software development can be hard work. Introductory books lay the foundation, but it can be challenging to understand where to go next. This book shows some of the pieces that can be brought together to make complete, cool applications.
苹果iOS是由苹果公司开发的手持设备操作系统。苹果公司最早于2007年1月9日的Macworld大会上公布这个系统,最初是设计给iPhone使用的,后来陆续套用到iPod touch、iPad以及Apple TV等苹果产品上。iOS与苹果的Mac OS X操作系统一样,它也是以Darwin为基础的,因此同样属于类Unix的商业操作系统。原本这个系统名为iPhone OS,直到2010年6月7日WWDC大会上宣布改名为iOS。截止至2011年11月,根据Canalys的数据显示,iOS已经占据了全球智能手机系统市场份额的30%,在美国的市场占有率为43%。 源码列表: 按钮类 按钮 Drop Down Control 按钮-Circular Music Player Control 》》Flat Pill Button 按钮类--Fancy Menu 按钮之Custom Gradient Button 按钮之Flat Button 按钮之NIDropDown 按钮之Popup Menu 按钮之UIMenuItem with Image 标签类 标签之Emoji Label 标签之Justifier Label 标签之Top Aligning Label 标签之单一label多颜色多字体 弹出视图 弹出视图 View Bounce Animation 弹出视图(Popup View)UIPopoverListView 弹出视图(Popup View)之URBAlertView 弹出视图(Popup View)之自定义菜单UIMenuBar 弹出视图-Patterned Alert View 弹出视图-Table Alert 弹出视图类--Blur ModalView 弹出视图类--Depth View 弹出视图类--FWTPopover 弹出视图类--icon sheet 弹出视图类--Informatic Toolbar 弹出视图类--WCAlertView 弹出视图之Depth Modal 弹出视图之SelectViewController 导航条 导航条(Navigation Bar)Navigation Menu 导航条(Navigation Bar)之Menu on NavigationBar 导航条类--iOS更换皮肤 导航条之Breadcrumb View 导航条之NavBarNotificationView 导航条之NavigationController Transition 导航条之Title Swipe View 导航条之Title View on NavigationBar 地图类--自定义地图标注 地图(Map)之SJOPaperboy 地图类--Custom Annotation 地图类--DirectionsKit 地图类--Location Indicator 地图类--简单的地图路径 地图类--自定义地图标注 动画类 动画--Spring LoadedView 动画-UIKitForGame 动画类--Guide Arrow 动画之Animation Sequence 动画之Genie Effect 动画之Steam View 分段选择类 分段选择(Segment)之URBSegmentedControl 分段选择类--SVSegmentedControl 扩展 分段选择之AKSegmentedControl 分段选择之Color Bar Segments 滚动视图 滚动的标签 滚动视图(ScrollView)Scroll Grid Controller 滚动视图--Infinite GridView 滚动视图类--CoverFlow 滚动视图类-Lazy ScrollView 滚动视图类--Parallax ScrollView 滚动视图类--Parallax View 滚动视图类-简单的广告栏 滚动视图类--拖动UIScrollView放大图片 滚动视图之Extended UIScrollView 滚动视图之MCPagerView 滚动视图之Page Scrubber Bar 滚动视图之Parallel View 滚动视图之SBFlowView 滚动视图之Wheel Component 汉字转换为拼音 滑竿类 滑杆(Slider)Circular Slider View 滑杆(Slider)之Range Selector 滑杆(Slider)之Volume Bar 滑杆类-Vertical Slider View 滑杆之Slider popover 滑杆之Trim Control 绘图类--My Palette 绘图类--超级简单的画正方形的方法 绘图之Drawing View 基于FMDB的数据库操作 简单阅读器 键盘类 键盘(Keyboard)之自定义表情键盘 键盘-FaceBoard 键盘-Keyboard Bar TextField 键盘类》》Number PadView 键盘类》》ZenKeyboard 键盘类--自定义的拨号键盘 键盘之Custom iOS Keyboard 进图条类 进度条(Progress)Circular Progress View 进度条(Progress)之Progress Toolbar 进度条-Colorful ProgressView 进度条类--Range Slider With Progress 进度条之circular timer 进度条之MCProgressView 开关类 开关(Switch)之RESwitch 开关-Simple Switch Demo 开关之Toggle View 开关之TTSwitch 列表类 联系人搜索算法 列表 纵向Table里嵌套横向Table 列表(Table)Cell Flip Segue 列表(Table)之DynamicHeights 列表(Table)之Expansion Table 列表(Table)之Horizontal table 列表(Table)之Pull Up To Refresh 列表(Table)之TableView with SearchBar 列表(Table)之UITable嵌套UITable 列表(Table)之UploadProgressView 列表-Rainbow Styled Pull To Refresh 列表-UITableView背景随动 列表类》》自定义Table View折叠效果 列表类-FormInputAccessoryView 列表类-Grid TableView 列表类-Grouped TableView With Shadows 列表类--iOS 6.0 Pull to Refresh 列表类--Section Selection View 列表类--Styled TableViewCell 列表类--TableView的各种操作 列表类--UIListView 列表类--下拉刷新加载SQLite数据 列表-让TableView的子view保持固定 列表之ExpansionTableView 列表之iOS Tree Component 列表之Refresh Control 列表之首列固定的列表 日历类 日历(Calendar)之Calendar Picker 日历(Calendar)之TimesSquare 日历之CalendarView 日历控件 日历之封装的My97DatePicker日历 社交类 社交分享-SinaWeibo Share 社交分享类》》ios6 Share Demo 社交分享类--Social Share TableViewCell 社交分享之KRShare 社交分享之MessageActivities 社交分享之ShareSDK 视图布局类 视图布局(View Layout)Border View 视图布局(View Layout)之Linear Layout View 视图布局(View Layout)之Quilt Layout 视图布局(View Layout)之模仿ness伸缩效果 视图布局-Animated Grid 视图布局-Note ViewController 视图布局-Side bar demo 视图布局-Sliding Grid View 视图布局类》》Circle Layout 视图布局类-HGPhoto Wall 视图布局类--Scaling For iPad mini 视图布局类--Swipe ViewController 视图布局之Cycled Viewer 视图布局之Dragging Buttons 视图布局之Mosaic UI 视图布局之Rounded View 视图手势切换 视图切换(View Transition)GuideViewController 视图切换类-3D浏览器 视图切换类--zaker应用进入画面效果 视图切换之视图切换大小渐变效果 手势交互--物体根据重力感应运动 手势交互之Drag View 手势交互之Touch Visualizer 图表类 图表--百分比圆环 图表类--Percentage Chart 图表类--极简个税计算器 图表之Rotation Pie Chart 图表之实时更新的曲线图 图像类 图像(Image)Transition ImageView 图像(Image)之Colorized Progress View 图像-AsyncImageView 图像-Blurred Image 图像-iOS Image Editor 图像-NLImageCropper 图像-Scratch View 图像类 -Photo Zoom 图像类》》360 Degree Panorama 图像类--Before After 图像类--Crop Image 图像类--Image Category 图像类--Image Select and Crop 图像类--OLImageView 图像类View With Bordered Image 图像类--图片下载和保存 图像之AmazeKit 图像之Croppable View 图像之ImagePickerController of InstaPDF 图像之ImageView With Preview 图像之Media Focus Manager 图像之Multiple Image Picker 网络类 网络类--Downloader Management 网络类--photo批量上传ftp 网络类--Reachability 网络之Multi Downloader 文字视图类 文字视图(Text)之AutoComplete TextField 文字视图(Text)之Bar Track ball Item 文字视图(Text)之Messages TableViewController 文字视图(Text)之TextView Placeholder 文字视图-HashTag Mention Controller 文字视图-Tweet Label 文字视图类--Digit Input 文字视图类--emoji-converter 文字视图类--Placeholder TextView 文字视图类--Swipe Shift Caret 文字视图之Autocomplete UITextField 文字视图之Clickable Label 文字视图之Hyperlink Label 文字视图之Note View 文字视图之Rich Content Label 相机类 相机-iOSMp4Camera 相机类>>Camera多张拍摄Demo 相机类--flash light 相机之实用手电筒 选项卡类 选项卡之AKTabBarController 选项卡之Arc Tab 选项卡之LSTabs 选择器类 选择器类--PickerView with Search Bar 选择器类--Value Selector 选择器类--Wheel Menu 选择器类--老虎机 选择器之定制多选的PickerView 音频声效类 音频声效 VoiceTTS Demo 音频声效(Audio)之语音识别 音频声效-iOS Mp3 Recorder 音频声效--VoiceTTS Demo 音频声效类--AAC Audio Converter 音频声效类--BobMusic播放器 音频声效类--Groover 音频声效之Hysteria Player 音频声效之Sound Board 游戏引擎类 游戏引擎(cocos2d)Castle Hassle 游戏引擎类》》模仿合金弹头Demo 游戏引擎类--tank大战 游戏引擎类--Tiny Seal 游戏引擎类--基于cocos2d的连连看游戏 游戏引擎类--简单炸弹人小游戏源码 游戏引擎类--切水果游戏 游戏引擎类幸运大转盘的抽奖游戏 游戏引擎-推箱子游戏 游戏引擎之雷电游戏的激光子弹 指示器类 指示器(HUD)之Android Style Toast 指示器-Activity Bar 指示器--Notify HUD 指示器之MBAlertView 指示器之YLActivityIndicatorView 其他类 财付通打印票据和拖动银行卡效果 寸光阴课程表 功能齐全的计算器 每日金句 扫雷游戏 数字输入 天气预报 之DDClock 之滚动视图旋转菜单 状态栏-StatusBar Notifier View 状态栏之MPNotificationView Ad Controller AdMob demo Animation之Gmail Like Loading AWVersionAgent Bee Framework Circle Menu Cocoa Touch Barcodes Contact Picker FileMD5Hash Fontastic Icons fontawesome Harpy iHasApp In-App Feedback In-App Purchase Inner Shadow Layer Keyboard之DLIDEKeyboard Leak Hunter Message Template NSLogger NSUndoManager Demo Open InApp Activity Passcode Passcode Lock Rating Control SBook ScaffoldKit for Core Data Shine Effect SKYdata Sliding Puzzle Board Spotlight System File Browser Ternary Search Tree UIBezierPath Symbol UITextField 焦点提示 Webview之UIWebView 离线浏览
2048游戏源码 # 2048 This is a derivative and the iOS version of the game 2048. In the very unlikely case that you don't know what it is, you can check it out [here](https://github.com/gabrielecirulli/2048). Made just for fun! You can find it on the [App Store](https://itunes.apple.com/us/app/2048-and-more!/id848859070?ls=1&mt=8).

Screenshot

## AI An AI is added, thanks to [DJBen](https://github.com/DJBen)! Tap "Hint" to show hint (e.g. Move left/right/up/down); tap "Auto Run" to run AI automatically. Check it out in the `AI` branch. You can also check out [this demo video on YouTube](https://www.youtube.com/watch?v=GF0ANNPpF8E). Thanks to [ov3y](https://github.com/ov3y/2048-AI)'s Javascript version that gave me (DJBen, that is) inspiration. ### Issues and pending improvements Currently the searching depth is 2 and it fails sometimes. You can increase the number to 3 or more by changing the return value of `- (NSInteger)maximumSearchingDepth` in `M2GlobalState+AI.h`. Ideally, the AI should search from 0 depth to infinity and have a time out, it records the current best move when finish searching the current depth and stops immediately when timed out and return the best move so far. However, I have a little bit of trouble when dealing with `NSOperationQueue` so I didn't do it this way. Now the AI only searches at the specified `-maximumSearchingDepth`. ## The Game Since it is a *derivative* of the original 2048, it is not the *same*. More explicitly, it has the following additions: * **Three board sizes**: 3x3, 4x4 and 5x5. The smaller the board is, the fewer cells you have, and the harder the game is.* * **Three game modes**: The original Power of 2, i.e. combining two tiles of the same value to produce their sum. The Power of 3, i.e. combining *three* consecutive tiles of the same value to produce their sum. Not surprisingly, this is pretty hard with the 3x3 board, although I found it pretty easy to get 81. 243 is a different story... And the Fibonacci sequence, i.e. combining two adjacent numbers in the sequence 2, 3, 5, 8, 13... (I omitted the two 1's in the beginning) to produce the one next to the larger value. This is pretty tricky. Try it out and you will know what I mean. * **Three themes**: I made a bright theme and a 'joyful' theme in addition to the original one. In case you wonder how to do themes in iOS. (There may be a better way, but themes are verbose in nature, because you *have to* specify all the colors, fonts, etc.) ## The Technology This version of 2048 is built using SpriteKit, the new 2-D game engine Apple introduced to iOS 7. As a result, it requires iOS 7 to run. On the other hand, this app has the following two great properties: * It does not rely on *any* third-party library. Not that Cocos-2D is not great, but the fact it's using SpriteKit means that it does not have any dependencies. * It does not have any images. That's right. The entire UI is done either via UIKit, or by Core Graphics. Check out the related files to see how that is done, if you are curious. You should be able to download the source, and build and run without problem. However, please note that you may not want to run it in the simulator unless you don't have an Apple Developer account. SpriteKit does use OpenGL, and simulating that using CPU will cause your computer to take off. ## The Code First off, the best thing about the code is that it's pretty well documented. Most methods have the Apple-style documentation, which means that you can triple-click on the method name to get its documentation. The code started to resemble the structure of the original 2048. So for example, it has a game manager, a board class, a tile class, etc. I at least *tried* to stick to MVC as much as possible. Here is a brief summary to get you started: * The `M2GameManager` class controls the game logic. There is only one action in the game: move. So the majority of that class is handling the move. The rest is checking whether you've won or died, etc. * The `M2Grid` class is the data structure for the board. The original 2048 used a 1-D array, but heck, 2-D array doesn't seem to be too bad here! ...except looping it is a bit ugly, so I made a `forEach` helper function. * The `M2Cell` class is the "slot"s. They are not the tiles themselves. The benefit of having this class is that the cells never move, so they are good references and they don't mess stuff up. * The `M2Tile` class is the actual tile, and **this** is the actual SpriteKit class. If all you want is some sample code for SpriteKit, here it is. I believe my animations are smoother than the other 2048 on the App Store, and are closer to the original animation. * The `M2GlobalState` class is a global class accessible from anywhere in the universe. Well, global stuff is evil, right? At least so we are told. But, it is at least better to encapsulate the global stuff into one single object (namespace), and that's a singleton right there. * The `M2Theme` class and its subclasses control the theme. * There are also some controller classes and view classes. It's probably a better idea to do the Game Over scene in SpriteKit, but I was lazy so I faked it using a view. The `M2GridView` class is the one that draws the board, btw. ### Contributing If you'd like to contribute, great! That's more than welcome. If you do make improvements to it, remember to put yourself in the "About 2048" page to get yourself credit. If you'd like to fork and make your own version, that's also great! Feel free to tinker with it however you'd like. It may not be a terribly good idea to change the font, add some ads, and submit to Apple, though. #### Contributors * Danqing Liu (me) * [Scott Matthewman](https://github.com/scottmatthewman) * [Sihao Lu](https://github.com/DJBen) ## Licence and Other 2048 for iOS is licenced under the MIT license. If you find the source code somewhat useful, all I ask is to download it from the [App Store](https://itunes.apple.com/us/app/2048-and-more!/id848859070?ls=1&mt=8), so I know that *someone* has seen it. Relax: It is free; it does not have any ads or weird stuff; it does not send you push notifications to ask you to go back and play it. You may also consider to [donate](https://github.com/gabrielecirulli/2048) to the maker of the original 2048 if you'd like, of course. (:

29,028

社区成员

发帖
与我相关
我的任务
社区描述
主要讨论与iOS相关的软件和技术
社区管理员
  • iOS
  • 大熊猫侯佩
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧