bool HelloWorld::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *unused_event)//12-设置在输出所点击的坐标
{
//auto touchLocation = touch->getLocation();
//touchLocation = this->convertToWorldSpace(touchLocation);
log(“the location is: %lf,%lf !”, touch->getLocationInView().x, touch->getLocationInView().y);
auto sprite_1 = this->getChildByTag(1);
//sprite_1->setPosition(Point(touch->getLocation().x, touch->getLocation().y));
sprite_1->runAction(MoveTo::create(3.0f, Point((touch->getLocation().x), (touch->getLocation().y))));
//setViewPointCenter(sprite_1->getPosition());
//----------------------//
return true;
}
只能在屏幕左下角一大块地走来走去。
出了左下角就开始乱跑。。
帮我看看错了哪里。。。 Classes.rar (4 KB)