Reputation: 667
Can someone please explain to me why I am getting this error message when I try to run this code:
let sprite = SKSpriteNode(imageNamed:"Spaceship")
sprite.xScale = 0.5
sprite.yScale = 0.5
sprite.position = location
self.addChild(sprite)
var dt: Float = 1.0/60.0
sprite.position.x -= 100.0*dt;
The error message appears on the last line by the way
Upvotes: 0
Views: 5196
Reputation: 46598
you need to change dt
to CGFloat
because sprite.position.x
have type of CGFloat
var dt: CGFloat = 1.0/60.0
in Swift, arithmetic operators require both operands have same type
Upvotes: 4