Objective c cocos解释中的触动
我不熟悉objective C和iPhone游戏开发。我在理解cocos中实现触摸的代码时遇到了一些困难。谁能给我解释一下吗Objective c cocos解释中的触动,objective-c,Objective C,我不熟悉objective C和iPhone游戏开发。我在理解cocos中实现触摸的代码时遇到了一些困难。谁能给我解释一下吗 -(BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)events { UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInView: [touch view]]; CGPoint co
-(BOOL)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)events
{
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView: [touch view]];
CGPoint convertedLocation = [[Director sharedDirector] convertCoordinate:location];
lady.position = convertedLocation;
return kEventHandled;
}
请给我解释一下这些密码。我想知道它是如何一行一行地工作的。
提前感谢UITouch ref
使用UITouch的
你可能需要更多
它看起来像标准的UITouch
处理代码
- 从“偶数”中发送的一组触碰中获得任何“偶数”触碰
- 获取给定视图中的位置-例如,从该特定视图角点的0,0开始的视图坐标中的位置
- 然后转换为“控制器”坐标,这是一个共享对象。。。(不知道是什么物体,但你知道他们在做什么)
- 将某物的位置(
)设置为触摸事件的位置lady