标签:
auto listener=EventListenerTouchOneByOne::create(); listener->onTouchBegan=[this,visibleSize](Touch* touch,Event* event){ auto sp=Sprite::create("ray.png"); auto v=150; auto s=touch->getLocation(); auto length=sqrt(s.x*s.x+s.y*s.y); auto action=MoveBy::create(2,Point(1000*s.x/length,1000*s.y/length)); sp->runAction(action); sp->setRotation(-CC_RADIANS_TO_DEGREES(asin(s.y/length))); sp->setPosition(0,0); addChild(sp); return false; }; Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener,this);
标签:
原文地址:http://www.cnblogs.com/yufenghou/p/4179955.html