私はゲームに取り組んでいます。このゲームでは、シングルタップとダブルタップでそれぞれ弾丸が発射された場合に、2つの異なるタイプを発射しようとしています。
これが私のタッチで行っている方法です。
- (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 LOCATION IN TOUCH BEGAN = (%f , %f)", location.x , location.y);
NSUInteger tapCount = [touch tapCount];
switch (tapCount)
{
case 1:
{
NSDictionary * touchloc = [NSDictionary dictionaryWithObject:[NSValue valueWithCGPoint:location] forKey:@"location"];
[self performSelector:@selector(startTimer:) withObject:touchloc afterDelay:3];
break;
}
case 2:
{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(startTimer) object:nil];
[self performSelector:@selector(removeBall) withObject:nil afterDelay:1];
break;
}
default:
{
break;
}
}
}
今、私の中で、perform selector(startTimer:)
私が触れたポイントの座標を取得しますNSPoint
(私が使用してNSDictionary
いるように)私が知りたいのは..それらのポイントをCGPointsに変換する方法です..?
どうすればいいですか?
どんな助けでも本当にありがたいです。