2014-09-28 37 views
0

你如何設定SKAction的起點?我試圖在一個圓圈中動畫一個節點,但我無法設置起始位置。它始終默認設置。這裏是我的代碼:SKAction起點

CGPathRef circle = CGPathCreateWithEllipseInRect(CGRectMake(self.frame.size.width/2-75,self.frame.size.height/2-75,150,150), NULL); 
self.circlePathActionClockwise = [SKAction followPath:circle asOffset:NO orientToPath:YES duration:5.0]; 
self.circlePathActionClockwise = [SKAction repeatActionForever:self.circlePathActionClockwise]; 

//[self.ball runAction:self.circlePathActionClockwise]; 
self.ball.speed = 1.0; 

回答

0

當試圖移動它時,圓的起點基於圓的位置。嘗試設置位置屬性,如下所示:

circle.position = CGPointMake(100,100); 

以上將設置圓的位置爲100,100。

CGPointMake將第一個數字作爲x軸座標,將第二個數字作爲y軸座標。我希望有所幫助。