copy and paste implements from cocos2d projext