创建一个在圆圈外旋转的对象

时间:2015-12-10 16:04:39

标签: ios swift sprite-kit

我尝试创建一个在圆圈外旋转的对象,但它会将其转到圆圈内。

这就是我想做的事情(我的角色)

enter image description here

 func moveClockWise() {

            var dx = Character.position.x - self.frame.width / 2
            var dy = Character.position.y - self.frame.height / 2

            var rad = atan2(dy, dx)

            Path = UIBezierPath(arcCenter: CGPoint(x: self.frame.width / 2, y: self.frame.height / 2), radius: 150, startAngle: rad, endAngle: rad + CGFloat(M_PI * 4), clockwise: true)
            let follow = SKAction.followPath(Path.CGPath, asOffset: false, orientToPath: true, speed: 200)
            Character.runAction(SKAction.repeatActionForever(follow))
    }

但发生了什么:

enter image description here

1 个答案:

答案 0 :(得分:4)

我没有按照你的确切方式去做..但这就是我想出来的。只需复制粘贴代码并试一试:)

enter image description here

<?php
    $request_method = $_SERVER["REQUEST_METHOD"];
    if($request_method == "GET"){
      $query_vars = $_GET;
    } elseif ($request_method == "POST"){
      $query_vars = $_POST;
    }
    reset($query_vars);
    $t = date("U");

    $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
    $fp = fopen($file,"w");
    while (list ($key, $val) = each ($query_vars)) {
     fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
     fputs($fp,"$val\n");
     fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
     if ($key == "redirect") { $landing_page = $val;}
    }
    fclose($fp);
    if ($landing_page != ""){
    header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
    } else {
    header("Location: http://".$_SERVER["HTTP_HOST"]."/");
    }

$to = "myNAme@yahoo.com";
?>