var posinonY:Float = Float(y) + Float(pipeDown.size.height) + Float(verticalPipeGap)
pipeDown.position = CGPointMake(0.0, Float(posinonY))
I get this error:
"NSNumber' is not a subtype of 'CGFloat'"
Why?
Edit:
CGFLoat need double type
pipeDown.position = CGPointMake(0.0, Double(posinonY))
this is ok.
As in Swift 4
use
Use
CGFloat(number)
instead ofFloat(number)
Since
CGFloat
is not aDouble
on 32bit, it becomes hard to use CGGeometry and frameworks like CoreGraphics or SpriteKit. This library makes it a little easier and hopefully Apple takes care of it soon.I wrote this to help out https://github.com/seivan/ScalarArithmetic
But if you want to just make it work without dependencies use
var myFloat:CGFloat
explicitly, and make sure to cast anyDouble
(numbers that are type inferred) toCGFloat
2.0 is inferred to be a Double and won't play along with theCG-Structs
on 32bit.