我收到两个错误。当我使用 <= 和 >= 时,它给了我错误:
二元运算符 '>= & <=' 不能应用于 CGFloat 和 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))
}
}
}
我需要帮助!