When I did the talk last week on iPhone Game Development, I showed some code at the end of the talk written using the Cocos2D framework. In both talks, the tetris portion of the demo was almost (but not quite) finished. I promised I’d post the code on github when it was finished, so here it is, my intro to iPhone Game Development sample project on github.
Tetris is playable, but this code is barely working, to be honest. I haven’t played with it on a device yet, and I know there are cases in the
rotatePiece method that haven’t been tested. I’ve got the next piece in the game model, but not showing up in the view. I was going to use Sneaky Input for the controls, but I ended up scrapping it and just using some really simple touch-based control instead.
Someday (hopefully soon-ish), I’ll be writing a blog post titled “how to write tetris in Objective-C using Cocos2D”. I’ll try and clean it up a bit then.