I'm getting two errors. When I use the <= and >=, it gives me the errors:
Binary Operator '>= & <=' cannot be applied to operands of type CGFloat and Int
override func touchesMoved(touches: Set<NSObject>, withEvent event: UIEvent) {
var speedOfTouch = 30
for touch: AnyObject in touches {
let location = touch.locationInNode(self)
if location.x < CGRectGetMidX(self.frame) {
square.position.x <= speedOfTouch
square.physicsBody?.applyImpulse(CGVector(dx: -40, dy: 0))
}
else {
square.position.x >= speedOfTouch
square.physicsBody?.applyImpulse(CGVector(dx: 40, dy: 0))
}
}
}
I need help!