HUDLayerとGameLayerでもタッチ検出が必要です。
player.position> 480の場合、ユーザーはGameLayerを適切に操作できないためです。
タッチ位置はHUDLayerに関連しています。これは良いことですが、両方のレイヤーにタッチする必要があります。両方のレイヤーで、タッチを有効にしてccTouchesBeganメソッドを試しましたが、ログには同じタッチ位置が2回表示されます。これどうやってするの?
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);
}
}