我工作的一个游戏,其中我试图分别若单水龙头,双击子弹射击两种不同类型。
继承人我在我触摸我开始做的方法:
- (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 ..?
任何想法,我该怎么办呢?
任何帮助将真正的赞赏。