为什么在 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);
}
我做错了什么,还有什么要做的?有没有更简单的方法来做到这一点???