Code from Learning Cocos2D modified to work with Cocos2D 2.0