void DaFeiJi::ccTouchesMoved(CCSet * touches, CCEvent *event) { if( _state == GAME_STATE::PLAY ) { CCSetIterator it = touches->begin(); CCTouch* touch = (CCTouch*)(*it); CCPoint start = touch->getLocation(); CCPoint delta = touch->getDelta(); CCPoint curPos = _ship->getPosition(); curPos= ccpAdd( curPos, delta ); curPos = ccpClamp(curPos, CCPoint(), CCPoint(_winSize.width, _winSize.height) ); _ship->setPosition( curPos ); } }