Chapter 2 - Getting Started
This chapter starts with the usual prerequisites. Download and install iPhone SDK and cocos2d. Installing cocos2d Templates. Creating the first project from a cocos2d project template.
From what I already wrote I estimate that will be about one third of the chapter. I think what would be most interesting in this chapter is to talk about general code structure of cocos2d projects. The basic elements like Scenes, Layers and Nodes. How to transition from one screen to another, to see that we’re actually doing something cool with little effort. For that I think the scheduled selectors should also be introduced to time transitions, and one screen might be a Layer which is waiting for touch input to advance to the next screen.
It might also be a good place to discuss cocos2d memory management, like static autorelease initializers, and making sure dealloc gets called when you switch scenes - otherwise you’re obviously having a memory leak.
The goal is to get the reader into a position where he feels comfortable laying out a screen structure in cocos2d. He knows how to initialize objects and how to add and remove them from the scene. The foundation of working with cocos2d if you so will.
What do you think should be in Chapter 2?
Let me know if you think I’m missing anything important. If you don’t have any suggestions then just think about what you would expect from the chapter by reading this description, that might give you some thoughts.
Also I would welcome any tips and the common pitfalls first-time cocos2d developers might trap themselves into. Expert tips are also welcome, those little nasty things or habits which could bite you later on if you don’t consider them from the beginning.
I’m looking forward to your feedback! The earlier the better. Chapter 2 will be submitted next Friday, July 9th.
What’s planned for the Chapter after this one
Just to put Chapter 2 in context, for Chapter 3 I’m planning to talk about essential cocos2d classes and processes. Sprites, Labels, Menus, Actions, etc. It’ll show you how to work with them using small code snippets. The chapter will probably have a “reference” character with various code samples, so that experienced users feel comfortable skipping ahead while beginners still find it easy and encouraging to pick up the details.
I’m writing a Book: Learn iPhone and iPad Cocos2D Game Development
I’m writing a book for Apress:
I guess someone wanted to be very precise and thorough. 😀
I will blog about the book’s progress here and when it’s published I will add additional materials so readers can continue their journey here. Since this journey is just beginning - I’m submitting the first chapter aptly titled “Introduction” tomorrow - and writing a whole 400 pages book is an entirely new experience to me, I want to let you in on the journey.
Help me help you by providing feedback to the book’s content as I’m writing it!
For the coming weeks, I will announce the current book chapter title and a short description and ask you what you’d like to see in this chapter. I will make these posts every Friday starting tomorrow until the book is complete. In this post you could start by telling me what you’d expect from this book or what you’d like to see in it just given its title? I guess your answer will be “a lot” given the title’s elongated nature. :p
I hope you forgive me if content updates to this website will not be as comprehensive over the coming months, in favor of writing the book and coding sample games. Plus I’m cooking up something special on the side, but all in due time.
Oh, by the way, if you happen to know what kind of fruit that is on the cover I’d like to know. I could just ask my editor but I’d like to see if we can figure it out without the help from Apress. It doesn’t really look like a coconut to me, which would have been fitting given the subject. If you have any ideas what fruit it is, let me know! It sure looks exotic and it’s definetely not a banana nor a lemon. So what is it? The first to post the correct answer in a comment, together with a link to Wikipedia or some other website as proof, gets a copy of the book for free when it’s out (or $40 now)!
And now for something completely different …
As a side note, the Xcode project files from the Xcode Tutorial are now available for download here. I used to ask you to join my Newsletter but I don’t feel too good about hooking you up with my Newsletter using the project as a dangling carrot, so joining the Newsletter will now be a completely voluntary thing. I only send newsletters for substantial updates and important news, at most once or twice per month, so that’s the thing you want if you are already struggling with RSS overflow.
Line-Drawing Game Starterkit for cocos2d (DELAYED, see comments)
On May 27th, the whole world saw the future. Because i told you so!
Line-Drawing Game Starterkit -> June 1st!
What’s that you ask?
It is the ideal starting point for your own Line-Drawing game! (like Flight Control and Harbor Master) It is a cocos2d source code project that will be available for sale. But not sight unseen, no. It will appear on the App Store for you to try out. And you get more, the full doxygen-generated source code documentation is available for browsing right now! Just so that you can assess the scope of the project.
What will it cost?
I admit i haven’t decided on that yet.
Show me your license!
Alright, alright. I’ll be fair: Free lifetime upgrades! Unlimited number of developers!
Each license is good for one published game. Additional licenses for follow-up games come at a discount. “Lite” versions do not require an extra license since they are essentially the same game. There will also be a commercial license for developers or studios who make more than $6,000 per month in revenue and can easily afford a higher price.
Why, please tell me why?
Because i can. I like technology and i like programming games. I’m also an enabler and i would love to see others build something unique based on game development technology i provide.
Anything else?
Yes. Today sees the premature end of the best new show of last year. RIP Flash Forward.
Xcode Tutorial Lesson: SpaceManager + cocos2d FAQ updates
I made a few additions to the Xcode Tutorial and the cocos2d FAQ which are based on user questions and concerns.
Xcode Project Tutorial: How to integrate Chipmunk SpaceManager
How to update the cocos2d-iphone code in a project created with a cocos2d Project Template? (Theory & Advice)
How to fix common Box2d compile errors? (must compile using C++)
How to fix common Chipmunk compile errors? (does not compile with C++ code)
How to draw an endlessly repeating Parallax Background? (very simple, very effective)
On Searching the Tutorial & FAQs
I’m still trying to get the search function on the Tutorial and FAQ pages fixed. Currently it works for the Xcode Tutorial only but other search result links may simply show an Error. I’ll try to get this fixed as fast as i can and i’m getting very helpful support from the folks at ScreenSteps Live so i’m hopeful.
Please also note that the search box in the navigation panel doesn’t search the FAQ and Tutorials, just the blog and pages.
Xcode Project Tutorial Updates: Box2d & Template
If you followed my Xcode Project Tutorial or received it after signing up for my Newsletter you may have noticed that it would not compile if you added #import “box2d.h” to any of your classes. I investigated and thanks to your comments the problem was easy to fix. I wrote a Tutorial lesson detailing box2d integration issues and how to solve them.
In addition, Tim Soliday who blogs at FatFingerStudios.com went through the effort of creating a “real” Xcode Template from my Tutorial project. By “real” i mean an Xcode Template that will be added to Xcode’s “File -> New Project” list of applications so that you can choose to start with a “cocos2d Application from there. This has also been requested by readers. I added another Tutorial lesson which describes how to install Tim’s Xcode Template.
I will add Tim’s Xcode Template to the Newsletter welcome mail in a couple minutes so new Newsletter subscribers will receive it automatically! If you have already signed up for my Newsletter you’ll have it in your inbox shortly, you do not have to sign up again!
The new Projectfiles you’ll receive also contain the box2d fixes and include my free source code collection and a number of other changes. Most notably the addition of License files and folder structure that go along with it which help me and my customers to differentiate between my base source code that is only licensed to the customer vs. source code that is later fully owned by my customers. Feel free to disregard or delete these License files if you have no use for them.