将精灵拖到屏幕上的某个位置后,如何自动将其移回?
我试过了:
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
for (UITouch *touch in touches) {
CGPoint location = [touch locationInNode:self];
CGPoint newPosition = CGPointMake(location.x, self.size.height/2);
self.start.position = newPosition;
}
SKAction *moveTo = [SKAction moveToX:self.frame.size.width/2 duration:0.5];
[self.start runAction:moveTo];
}