Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将这行代码转换为swift,我正在尝试使精灵沿着一条环形路径运行_Swift_Sprite Kit_Uibezierpath_Skaction - Fatal编程技术网

如何将这行代码转换为swift,我正在尝试使精灵沿着一条环形路径运行

如何将这行代码转换为swift,我正在尝试使精灵沿着一条环形路径运行,swift,sprite-kit,uibezierpath,skaction,Swift,Sprite Kit,Uibezierpath,Skaction,如何将此行代码转换为swift: // circle path UIBezierPath *circle = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 100, 100) cornerRadius:100]; SKAction *followCircle = [SKAction followPath:circle.CGPath asOffset:YES orientToPath:NO duration:5.0

如何将此行代码转换为swift:

// circle path
    UIBezierPath *circle = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 100, 100) cornerRadius:100];
    SKAction *followCircle = [SKAction followPath:circle.CGPath asOffset:YES orientToPath:NO duration:5.0];
正如您所看到的,代码非常相似,只是语法不同

祝你玩得开心

let circle = UIBezierPath(roundedRect: CGRectMake(0, 0, 100, 100), cornerRadius: 100)
let followCircle = SKAction.followPath(circle.CGPath, asOffset: true, orientToPath: false, duration: 5.0)