Lean iPhone Game Development: Day 2

July 12th 2011

Sometimes the second steps of a journey are just as difficult as the first. Today I finally dug into development and discovered that I’m in over my head in a few areas. To parrot the sentiment of Teen Talk Barbie: “Physics class is tough!”. I don’t have much choice except to buckle down and learn this stuff as fast as possible.

Working Prototype

Before putting any effort into design, I must first prove out the basic concept of the game. Doing design work for a game that won’t fundamentally function is like polisihing brass on the Titanic. Completely pointless.

Frameworks Galore

After taste-testing a few game engines I settled on Cocos2d as the game engine for Bastard Bricks. It’s free and it has an extensive community behind it (something I always look for when choosing an open source library).

Best of all, Cocos2D provides Xcode templates which create boiler-plate projects for both Chipmunk and Box2D. I wanted to incorporate a physics engine as the main means of motion for the sprites. These templates make my work much easier. I settled on Box2D as that seemed to be what most others on the Cocos2D forums were using.

Fleshing Things Out

Out of the box, the Cocos2D/Box2D demo app looks creates bricks that drop based upon the gravity setup in the Box2D environment. It looks something like this:

To create the stack of bricks at the top of the screen, I reverse the gravity:

This made it so that the bricks would float to the top of the screen. Then I place brick sprites on the screen next to each other in 4 rows. I calculated them as carefully as possible, but I let gravity do most of the work. In addition I colored each row similar to the Atari Breakout. That just makes it look kind of nice.

I was also able to add the ball as well by copying the sprite configurations for the bricks, and then modifying it. The Ball drops in the direction of gravity, then comes to rest on the bricks. Not too exciting.

The Next Steps

This prototype is nowhere near complete. There’s several things I’d like to get working before I’d be comfortable with proceeding. First, the ball needs to move. I’ll have to figure out a way to balance out the gravity and then give the ball its own motion vector.

Also, I still don’t have any sort of user interaction. I need to get the paddle on the screen and have it react to touches.

As long as I can get these few things squeezed into this prototype. I think I can make this work.

blog comments powered by Disqus