Touch to Coordinates (Simulate user click)

Touch to Coordinates (Simulate user click)
0.0 0



I write automatization for cocos2d-x game. For now I recieve elements from scene and need to touch on this elements.

So, How I can simulate user click on coordinates from code? If it’s impossible of course =)

A lot of thanks


To simulate the click, you can use: ccTouchesBegan and ccTouchesEnded
To get the coordinates:

void MyClass::ccTouchesEnded(cocos2d::CCSet* touches, cocos2d::CCEvent* event){
	CCTouch *myTouch = (CCTouch *)touches->anyObject();
	CCPoint location = myTouch->getLocationInView();
	location = CCDirector::sharedDirector()->convertToGL(location);


Can you clarify? As I Known ccTouchesBegan calls after user touch on display. But I need send command via network to cocos2d-x game to GetActiveScene, then find elements with coordinates and then I need rise touch event on this coordinates from code, not from user touch. Thanks


Any Idea How can I simulate touch event?