cocos by example ch6