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,避免加法