cocos2d Book, Chapter 9: Particle Effects

On August 21, 2010, in Announcements, book, cocos2d, by Steffen Itterheim

Chapter 9 – Particle Effects

Those tiny specks which you can see on your touchscreen after a sneeze.

Not exactly. Of course I mean the cocos2d particle system and its built-in particle effects which will be the focus of this chapter. And no discussion of particles would be complete without describing the workflow revolving around the Particle Designer tool.

Summary of working on Chapter 8 – Shoot ’em Up

This certainly wasn’t the easiest chapter for me to write. I had very ambitious goals, maybe too ambitious for 27 pages. I did manage to sneak in quite a lot though, here’s a partial list:

  • how to refactor existing code to make it work better with the new features
  • how to pool bullets and enemies together for easier access and better performance
  • how to not use too many subclasses, instead relying on type switches
  • how to use cocos2d’s node hierarchy as a simple component system for writing reusable game logic components
  • how to implement basic movement, shooting and a healthbar as components
  • how to detect collisions between bullets and enemies

The not so easy part was striking the right balance. Not going too technical. Not doing too much at once. Not dividing things into too many tiny pieces. But most of all I frequently encountered various bugs in the code, or just unexpected behavior of cocos2d which forced me to spend more time debugging and sometimes backtracking changes than I was prepared for.

After a long and hard work week, paired with physical exhaustion and an late-summer allergy burst, my concentration didn’t allow me to work at 100% capacity. In the end I did manage but it took longer than I had planned, I’m over a day late to submit this chapter. The next one will be easier though, and it has to be as I’m preparing for a short trip near the end of next week. I certainly am looking forward to a couple days off now. :)


This article was brought to you by ...

I very much enjoy the learning process, the pushing of boundaries (mine and yours and that of technology), having the freedom to pursue whatever is on my mind, to boldly program what no one has programmed before, and to write about what I've learned. Help me help you by browsing the products in the Learn Cocos2D Store.

8 Responses to “cocos2d Book, Chapter 9: Particle Effects”

  1. guyal says:

    General comments – am up to chapter 4, finding it all very valuable. As in, its trivial to figure out how to put a CCSprite onscreen and move it, but I’ve learned a lot of the bits and pieces to make it all work well, like using mult instead of div, or the explanation of autorelease in Cocos. The upcoming chapter list looks promising, also. Already worth the money spent.

    But I am looking forward to access to the source code, as I’m having a bit of trouble with taking the fragments of DoodleDrop code and making it live. There’s nothing quite like having a functional project to tinker with…

    PS I appreciate a game dev book actually written by an experienced, professional game developer. It’s amazing (albeit rationally explicable) that the vast majority of the game dev books are written by people who’ve never shipped significant titles (AAA, or a strong string of indie work). And the exceptions are almost all article collections (Gems, ShaderX, etc), rather than a full length, deep dive like this.

  2. David says:

    Easy read, learned a lot of things that were a bit blurry on cocos2d wiki page and also new things came to clarity that were a bit shady from my own trail and error sessions…. Waiting for the next chapters. Keep it up!

  3. dm says:

    Essentials, page 9. -> “The keyword _cmd is shorthand for the current method.”

    _cmd is a hidden parameter of type SEL (as self of type id) to method implementation and not a keyword.

  4. Greg Meach says:

    I too found the first 5 chapters very well written and I’ve had “ah-ha” moments throughout. If there’s anyway you can pester Apress to release more chapters – I’d like to keep reading… Thanks again
    Greg

  5. Chris says:

    Would be very cool if you add something about the high-res textures! I’d like to know how i can get the best out of cocos2d on iphone4.

  6. David says:

    You sure know how to write understandable texts but your graphics is obviously not your area of expertise…..Lol

    Love your stuff, waiting for the next chapters to arrive…

    Great tutor Steffen
    David