How to get Location of my TOUCH!HEELP

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);
//TPoint->setPosition(location);

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

}

1 Like

It worked!!!
THANK YOU!!:slight_smile:
I REALLY APPRECIATE IT