我有一个精灵,我可以在屏幕上拖动。我的问题是如何使它也自动旋转。SpriteKit根据触摸位置旋转精灵
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if(_dead)
return;
NSArray *touchArray=[touches allObjects];
if ([touchArray count] == 1)
{
[_player runAction:[SKAction moveTo:[[touches anyObject] locationInNode:self] duration:0.01]];
}
}
目前这是我的代码,它是完美的draging。
旋转到它正在移动的方向? – ZeMoon