在我的游戏中,只有一个精灵响应触摸。无论我在屏幕上触摸的哪个位置,如何让鼠标关节移动这个精灵/身体?
问问题
99 次
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 回答