2016-04-16 16 views
0

私は男を左に移動させようとしていて、右に回り、次に移動します。私はSKActionシーケンスを使用しているSpritekitでこれを行う方法を知っています。しかし、私は実際にゲームではなくアプリでやっているのが苦労しています。私が今持っているのは、その男が同時に動いて回転することになるでしょう:spritekitゲームのようなアプリでアクションシーケンスを作成するには?

UIView.animateWithDuration(5.0, delay: 0.0, options: [ .Repeat, .Autoreverse, .CurveEaseInOut], animations: { 
     self.guy.center.x -= 130 
     }, completion: nil) 

    //  
    UIView.animateWithDuration(5.0, delay: 5.0, options: [ .CurveEaseInOut, .Repeat, .Autoreverse ], animations: { 
     self.guy.transform = CGAffineTransformMakeScale(-1, 1) 
     }, completion:nil) 

ありがとう!

答えて

0

最初のアニメーションが2番目のアニメーションを開始する場合は、完了ハンドラを使用できます。

関数にこれを入れて、ループ

UIView.animateWithDuration(5.0, delay: 0.0, options: [ .Repeat, .Autoreverse, .CurveEaseInOut], animations: { 
    self.guy.center.x -= 130 
    }, completion: { 
     UIView.animateWithDuration(5.0, delay: 0.0, options: [ .CurveEaseInOut, .Repeat, .Autoreverse ], animations: { 
      self.guy.transform = CGAffineTransformMakeScale(-1, 1) 
    }, completion:nil) 
}) 
を作成するためにタイマーでこの機能を発射
関連する問題