0

在我的游戏中,只有一个精灵响应触摸。无论我在屏幕上触摸的哪个位置,如何让鼠标关节移动这个精灵/身体?

4

1 回答 1

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;

于 2013-05-24T00:41:12.940 回答