Search This Blog

Friday, November 19, 2010

Cocos2D iphone tutorial: Die, Grossini, Die! – Part II

(Click here Part I)


Previously, we described the fundamentals of a Cocos2D game (or in this case, 'show') and explained how everything is set up. Let's describe the game, now.

If you came here directly, Part I is here.

The image on the left is the splash screen that I use for the game. I replaced the default Default.png cocos2d image with this one. You will notice Grossini has a nice 3D effect here. That's just a simple Bevel effect on a layer. You can do this in GIMP, Photoshop or many other editors. The source for this classy looking Grossini image (well, just the regular image with a stick drawn on the right is here)

Cocos2D iphone tutorial: Die, Grossini, Die! – Part I

Click here for Part II.

What do I have against Grossini? I don't like the  way he dances.

Okay, if you are shocked, take it easy. Its my spotty sense of humor. Who is Grossini? Well, Grossini, is a bald headed dancing sprite that Cocos2D has made immortal. I have just started learning Cocos2D as a platform for game development. After my earlier effort of building Bricks using UIKit, I discovered Cocos2D-iphone and this is my first venture into it. Cocos2d-iphone is a port of the cocos2d engine for the, umm, iphone by Ricard Quesada.

Cocos2D is an excellent and easy to use iPhone 2D gaming engine with pre-built operations for a whole bunch of stuff. While there aren't too may good books on Cocos2D today (there are some that will be released later this year), there are excellent online resources and tutorials on the same.

The Obligatory Video of what we will be developing


No, its not really a game. Just sit back and watch some jumping and blood-shed.


What "GrossiniDie" is intended to do


You may have already figured it out from the video. Basically, our goal is to present a user with a "Main Screen". Once he selects "Play Game" we want to show an animated sprite (Grossini) dancing on the screen and jumping around as well. As he jumps, there are knives positioned at the top. If he hits a knife, we play a horrid scream, spill some blood and he continues to bounce. To make it is little more random, the knives  move up or down a bit after a hit. This is a "show" not a "game". You sit back and giggle at Grossini's fate.