cocos2dx でスプライトをドラッグするのが難しいのはなぜですか! 私の touchesbegan メソッドでこれを行う
void HelloWorld::ccTouchesBegan(cocos2d::CCSet* touches, cocos2d::CCEvent* event){
CCSprite *splash = CCSprite::spriteWithFile("splash3.png");
CCTouch* pTouch = (CCTouch*)(touches->anyObject());
CCPoint location = pTouch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
splash->setPosition(ccp(location.x,location.y));
this->addChild(splash,5);
}
void HelloWorld::ccTouchesMoved(cocos2d::CCSet* touches, cocos2d::CCEvent* event){
CCSprite *splash = CCSprite::spriteWithFile("splash3.png");
CCTouch* pTouch = (CCTouch*)(touches->anyObject());
CCPoint location = pTouch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location);
splash->setPosition(ccp(location.x,location.y));
this->addChild(splash,5);
}
私は何を間違っているのですか?これを行う簡単な方法はありますか?