Book: Learn Cocos2D 2
Learn Cocos2D 2 (Third Edition)Release Date: August 29, 2012 Also explains TexturePacker, PhysicsEditor, Tiled, Glyph Designer, Particle Designer and other tools. Source code is compatible with Xcode 4.4, iOS 6 and Mountain Lion (Mac OS X 10.8). Download Source Code (3rd Edition):Cocos2D Source Code (ARC) (Cocos2D v2.0; includes 12 Cocos2D ARC templates) Exact game engine versions used by the book: |
|
Second EditionRelease Date: November 9, 2011
Download Source Code (2nd Edition): |
First EditionRelease Date: December 2, 2010 Download Source Code (1st Edition): |
Full Description
Create compelling 2D games with Learn cocos2d 2: Game Development with iOS. This book shows you how to use the powerful new cocos2d, version 2 game engine to develop games for iPhone and iPad with tilemaps, virtual joypads, Game Center, and more. It teaches you:
- The process and best practices of mobile game development, including sprite batching, texture atlases, parallax scrolling, touch and accelerometer input.
- How to enhance your games using the Box2D and Chipmunk physics engines and other cocos2d-related tools and libraries.
- How to add UIKit views to cocos2d and how to add cocos2d to UIKit apps.
- The ins and outs of the Kobold2D development environment for cocos2d and its pre-configured libraries, including Lua.
Best of all, this book will have you making games right from the very start. It guides you step-by-step through the creation of sample games. These fun examples are modeled after popular App Store games and teach you key concepts of the new cocos2d 2 game engine and relevant tools like TexturePacker (texture atlas), PhysicsEditor (physics collision shapes), Particle Designer (particle effects), Glyph Designer (bitmap fonts), and others.
This book offers a rock-solid introduction to creating games made entirely with cocos2d and little or no iOS SDK and OpenGL code. It also details alternative implementations, identifies the best free and commercial tools for cocos2d game development, features coverage of the author’s improved cocos2d game engine (Kobold2D), and even helps you enhance your game’s marketability on the App Store.
Who this book is for
The book is aimed at beginning game developers looking for an easier and even more powerful way to create compelling 2D graphics using OpenGL and Objective-C. It is assumed that the reader will have some knowledge of object-oriented programming and the Apple and iPhone/iPad developer environment.










Hi Steffen, this is my first post. I am impressed by the support of an expert, who else can answer a query on the book, of course the writer himself. Will be posting next after this test post.
I am a mainframe developer for 12 years. Am very new to OOP concept. Purchased a book on objective c tutorial by stephen kochan, after finishing it, bought an IOS 5 book by Jeff Lemarche,still currently reading it. In the end , I want to develop iphone games. Am I better off to discontinue reading the IOS 5 book and just go straight into learning cocos2d? Any comment or suggestion is much appreciated.
Hard to say. If your goal is to make games, then the iOS book is probably teaching you only about UIKit. But you need at the very least OpenGL experience, or better avoid that by using a game engine such as cocos2d. Specifically for someone new to making games the OpenGL stuff can really be a drag and sidetrack you a lot from actually implementing a game. If you feel comfortable enough with Objective-C I think you should read books and tutorials about game development with cocos2d, or perhaps OpenGL if you really dig the technical side of rendering.
Thanks Steffen, will just complete my ios5 book and get your latest book on cocos2d. Will surely post some questions in the future. About your cocos2d tutorial, is this an online course and what is the cost if you don,t mind asking here.
Well for books I’m obviously recommending mine.
It’s written in tutorialesque form, step-by-step and not skipping ahead.
And there’s also plenty of online tutorials from absolute beginner level to more advanced or specialized ones. For example Ray’s website has tons of iOS tutorials, and the simple cocos2d game tutorial is still a great introduction even though it’s 2.5 years old now (meaning it’s not compatible with the latest cocos2d versions).
Hey Steffen,
I’m going to spend the next two semesters developing an iOS game with Cocos2D. Being unfamiliar with Obj-C as well as the 2D engine, I have my work cut out for me. I purchased your book (v3) to help expedite the learning process. That being said, the publication date has been pushed at least two times now, and I simply can’t wait much longer. Are there any other well-established walkthroughs of the Cocos2d engine that you can point me to?
Thank you for your time,
~luke
According to Amazon.com the publication date is now September 19th.
I think Ray Wenderlich has the best tutorials, check the cocos2d category respectively search for cocos2d.
Unfortunately there are very few tutorials available from anyone that use cocos2d 2.0. Still you can learn some of the basic principles from any beginning level cocos2d tutorial.
I’m also working hard on the online Cocos2D Essential Reference, if possible I will try to match the book’s release date so it has a companion reference. More details soon on my blog.
I just had to comment…
The book (3rd ed.) finally arrived and is superb. This is precisely what I was looking for to help get my head around Cocos2d. The chapters on Sprites and Parallax are added bonuses; I never knew the steps to take to optimize texture packing or how to reuse sprites, and this book lays it out quite clearly. I have picked up several more-general coding tricks/tips as well just from reading through your stuff.
One caveat– Ch07 source code, when opened via .xcworkspace precompiles with one warning and an error (Xcode 4.5):
1. Xcode wants me to “update to recommended settings” which says it will combine high res. artwork into a single file while building. Should I do this, or will it break something?
2. It provides and error reading “linker ocmmand failed with exit code 1.” My intuition is that Xcode is having a hard time finding Kobold libraries, but I’m not sure and I don’t know what to do.
I solved my own problem. It appears that some chapters in the book’s source code omit /users/[username]/library/developer/xcode/deriveddata/[chapter]/build/product/debug-iphonesimulator/ [libraries].
I’m assuming you left these libraries out by choice, as lots of the examples don’t touch them. For some reason my simulator wanted to know where they were, however.
“Update to recommended settings” is usually safe. Xcode 4.5 wasn’t available when I wrote the source code.
I’ll check the Simulator issue, not sure but might be Xcode 4.5 related too.
Btw the Ch07 project (Kobold2D version) runs fine on Xcode 4.5. Didn’t ask me to update settings either.
Hey just wondering if the new version of the book covers things like graphic sizes for the new iOS hardware coming out. Or how to adapt for creating graphics for now possibly six different display frames ( iPhone iPhone HD iPad iPhone 5 iPad mini ).
Also anything on dealing with ios6′s new way of auto- rotation and game center?
If so I will buy that fast and tweet it for all the world to read.
Big fan!
Justin
The display resolutions are listed in a reference and the required file extensions are also explained. But since iPhone 5 and iPad mini aren’t available yet, they aren’t covered. It’s not even clear yet if cocos2d needs additional changes to support them. In general device resolutions are a simple matter of scale, ie design images in the highest supported resolution (or higher), then scale them down accordingly. A tool like Texture Packer (explained in the book) helps tremendously in this process.
Similar for iOS 6 autorotation, the changes are not in cocos2d yet (Director still uses shouldAutorotateToInterfaceOrientation). These methods are only marked as deprecated though, meaning they’ll continue to work for the time being but generate a compiler warning. In any case I’ll cover autorotation in the Essential Reference online documentation I’m currently writing.
I´ve got it
http://mocabu.com/files/cocos2dbook.jpg
Benjamin
Awesome!
Hey,
Will this book be available as eBook of PDF?
I can only find the alpha book on apress.
Thanks,
Daniel
Yes, the final version will be available as PDF, ePub and Mobi. If you get the alpha version (PDF), the other versions will become available for free.
I don’t know why the eBook is still in Alpha. I guess it’ll change soon now that the print book is shipping.
I should have read this before buying the alpha book (3 mins ago) as I am not sure how out of date it is from the final released version.
Original Source Code (Cocos2D 0.99.x)
the zip password is what?
None of the download archives are password protected. I downloaded 0.99.x to verify and it didn’t ask for a password. You might want to try re-downloading the file in case of corruption or an incomplete download.
Hi Steffen, is the final version of the ebook out yet? I would like to know before making the purchase. Thanks for the awesome work.
Yes, it’s available: http://www.apress.com/9781430244165
Is the kindle version the same as paper book?
Thanks
Yes, it’s the same. Minus the paper.
Hi Steffen, the sample code accompany with this book seems have a problem of switching device orientation in iOS6. They always show in portrait. I tried the orientation settings in both app delegate and project settings, but no luck.. How can I fix it? Thanks~
That’s a common issue introduced with iOS 6, it needs an extra method that’s not implemented in cocos2d 2.0 but it’s in the 2.1 beta. Implement the supportedInterfaceOrientations method and return the supported orientations. It should suffice to add this method to the CCDirectorIOS class.
Thanks for pointing me to the right direction
btw, we also need to update the app delegate as pointed in this post:
http://www.cocos2d-iphone.org/forum/topic/49220
I added the supportedInterfaceOrientations method to CCDirectorIOS and am still having this issue. Is there something I’m missing?
nm I found the resources at the top of this page.
Thanks!
Hi Steffen
i want to know if i can use the source code of the first edition of the book “learn iphone and ipad cocos2d game development” in xcode 4 or i can use only in xcode 3
I haven’t tried it, I’m pretty sure it won’t work without issues because Xcode 4 uses a different and more advanced compiler.
so what can i do to work in xcode with cocos2d or which book can i use and which is the difference between the one source code and the other one
The third edition is most up to date, uses cocos2d 2.0, ARC and works with Xcode 4.
tank you Steffen
and can you tell me which is the difference between the two sources of code
Hi Steffen I just bought your cocos2d 2 (third edition). When I’m trying to convert my project into ARC and link cocos2d as static library, everything works and compiles. But when I run it on iphone 5.1 simulator I get this error. Any idea how could I fix this?:
dyld: lazy symbol binding failed: Symbol not found: _objc_setProperty_nonatomic
Referenced from: /Users/gerrytan/Library/Application Support/iPhone Simulator/5.1/Applications/83B7CDB8-E29C-4232-A525-C61A81CEE159/hellococos.app/hellococos
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/Foundation.framework/Foundation
dyld: Symbol not found: _objc_setProperty_nonatomic
Referenced from: /Users/gerrytan/Library/Application Support/iPhone Simulator/5.1/Applications/83B7CDB8-E29C-4232-A525-C61A81CEE159/hellococos.app/hellococos
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk/System/Library/Frameworks/Foundation.framework/Foundation
This can occur if you set the deployment target of either the app or the static library target to a higher iOS version than the device/Simulator runs on. Since you run on Simulator 5.1 it’s probably set to 6.0 in one of the targets, most likely the static library target because iOS 6 is the default when creating a new target. That means you can actually select to run on Simulator 5.1 if your app’s target is set to deployment target 5.1 but the code in the static library target will not be compatible with iOS 5.1. So make sure all targets use the same deployment target.
I downloaded the source code for both cocos2D and Kobold2D and I noticed that there was an alien.png but not alien-hd.png. Is there a newer resource folder available for download? I just made my own alien-hd.png for now but I’m worried that in future projects I’ll be missing resources that are more important.
There’s no alien-hd.png, I don’t have the source in high resolution.
The book said “The player images alien.png and alien-hd.png are located in the Resources folder of the DoodleDrop project supplied with the book”. No big deal if that’s not the case, I was just worried I might be missing stuff in future chapters.
I also don’t seem to have a “ScenesAndLayers01 project” described in Chapter 5. Is the source code from the link above “Cocos2D Source Code (ARC) ” and “Kobold2D Source Code (ARC)” or is there a link to the full source code somewhere?
Please delete all my comments – I re-downloaded the source code and everything’s there. Must have been a partial download or trouble unzipping. Thanks!
After updating Xcode, I had to comment out all the “FIX_CATEGORY_BOOK”
from the source code of the book, or I got the following error:
“note: add a super class to fix this problem
1 error generated.
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1″
What happened?
I have the same issue as Alex mentions above. Any chance you will update the code to work with xcode 4.6?