在我的游戏中只有一个精灵响应触摸。无论我在屏幕上触摸什么位置,如何使鼠标连接移动此精灵/身体?
答案 0 :(得分:0)
- (void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL:location];
mySprite.position = location;
}
确保init
方法self.isTouchEnabled = YES;