我正在开发一款游戏,如果子弹分别在单击和双击上,我会尝试发射两种不同类型的子弹。
这是我在触摸开始方法中所做的事情:
- (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..?
知道我该怎么做吗?
任何帮助将不胜感激。