port from cocos2d-iphone