I need touch detection in HUDLayer and GameLayer also.
Because when player.position > 480, user can’t interact with GameLayer properly.
Touch location is relevant to HUDLayer, which is good but i need to have touches on both layers. I tried ccTouchesBegan methods with touching enabled, in both layers but Log is still showing same touch location twice. How can i do this?
GameLayer.mm
- (void) ccTouchesBegan(NSSet *)touches withEvent:(UIEvent *)event
{
for(UITouch *touch in touches ) {
CGPoint location = [touch locationInView: [touch view]];
location = [CCDirector sharedDirector] convertToGL: location];
NSLog(@"Touch X: %f Y: %f", location.x, location.y);
}
}
If i understand right what do you want to do, you just need to convert touch position to node space with