Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/108.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
Ios 如何在Swift的Spritkit中创建动态位置_Ios_Swift_Swift3_Sprite Kit - Fatal编程技术网

Ios 如何在Swift的Spritkit中创建动态位置

Ios 如何在Swift的Spritkit中创建动态位置,ios,swift,swift3,sprite-kit,Ios,Swift,Swift3,Sprite Kit,我只有一个具有以下变量的场景: widthOfScene = self.size.width heightOfScene = self.size.height var constLabelPosition = CGPoint(x:witdhOfScene*0.6, y: heightOfScene*0.95) var dynamLabelPosition = CGPoint(x: constLabelPosition.x * 0.1, y: constLabelPosition.y) 即使我决

我只有一个具有以下变量的场景:

widthOfScene = self.size.width
heightOfScene = self.size.height
var constLabelPosition = CGPoint(x:witdhOfScene*0.6, y: heightOfScene*0.95)
var dynamLabelPosition = CGPoint(x: constLabelPosition.x * 0.1, y: constLabelPosition.y)
即使我决定在几个月内更改
constLabelPosition
,我也希望我的标签始终保持在constLabel的10%左右。
我的代码不起作用<代码>动态标签< /代码>总是在<代码>中间标签CONTABLE …有没有办法实现这样的动态标签位置?

< P>对不起,但是这似乎是对动态标签X位置的一个简单的错误计算。

你确定你不是说:

var dynamLabelPosition = CGPoint(x: constLabelPosition.x + constLabelPosition.x * 0.1, y: constLabelPosition.y)

或者直接乘以1.1,避免加法