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.
Hi, I am a technician/programmer in the School of Psychology at Plymouth University, UK. I write programmes for Psychological research in response to requests from academic staff. I normally write in various .NET technologies, but have a request for a questionnaire on the iTouch. The questionnaire is working fine but the requester wants 3 minutes of Tetris as a distraction in the middle, but we are on a tight schedule and I was wondering if you could tell me how to incorporate your tetris code into the exisiting project. I am very happy to learn what I need but time is a problem. Any help would be appreciated.