How to get Location of my TOUCH!HEELP

How to get Location of my TOUCH!HEELP
0.0 0


Hi again!
i would like to know how to get a touch location
in my case, i need to get the Y coordinate of my touch…
Can u help to get that.
I WILL APPRECIATE IT!:slight_smile:


You could use CCPoint property by calling location.Y directly.
In this one i use single touch, If you use touches then pTouches->anyObject(); to get touch

bool GameLayer::ccTouchBegan(CCTouch *pTouch, CCEvent* event) { // This method is passed an NSSet of touches called (of course) "touches" // We need to convert it to an array first CCSize winSize = CCDirector::sharedDirector()->getWinSize();
CCPoint location = pTouch->getLocationInView();
location = CCDirector::sharedDirector()->convertToGL(location);

//location = CCDirector::sharedDirector()->convertToGL(location);
else if(location.x < winSize.width/2)shuttle_->ShuttleLeft();
else if(location.x > winSize.width/2)shuttle_->ShuttleRight();
return true;



It worked!!!
THANK YOU!!:slight_smile: